有没有办法通过命令提示符更改系统设置(如在我的示例中,显示/隐藏隐藏的文件夹和文件)?如果是这样,这是如何完成的?
最佳答案
要启用您提到的选项,您可以使用REG ADD
:
reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 0x1 /f
Windows 资源管理器选项中的“显示隐藏的文件、文件夹和驱动器”等设置最常存储在注册表中。例如,这个看起来像这样:
User Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
Value Name: Hidden
Data Type: REG_DWORD (DWORD Value)
Value Data: (1 = show hidden, 2 = do not show)
您可以使用reg
命令通过命令行修改 key 。在此处查看更多信息:https://ss64.com/nt/reg.html
要查看“显示隐藏文件”设置是否启用,您可以使用reg query
:
reg query HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden
关于 reg add
的更多信息:
REG ADD KeyName [/v ValueName | /ve] [/t type] [/s Separator] [/d Data] [/f]
KeyName [\\Machine\]FullKey
Machine Name of remote machine - omitting defaults to the current machine
Only HKLM and HKU are available on remote machines
FullKey ROOTKEY\SubKey ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ] SubKey
The full name of a registry key under the selected ROOTKEY
/v The value name, under the selected Key, to add
/ve adds an empty value name <no name> for the key
/t RegKey data types
[ REG_SZ | REG_MULTI_SZ | REG_DWORD_BIG_ENDIAN | REG_DWORD |
REG_BINARY | REG_DWORD_LITTLE_ENDIAN | REG_NONE | REG_EXPAND_SZ ]
If omitted, REG_SZ is assumed
/s Specify one character that you use as the separator in your data
string for REG_MULTI_SZ. If omitted, use "\0" as the separator
/d The data to assign to the registry ValueName being added
/f Force overwriting the existing registry entry without prompt
关于windows - 通过命令提示符更改 "Show hidden files and folders"设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45014971/