Reputation:
Is there a way to change system settings (like in my example, to show/hide hidden folders and files) via the command prompt? If so, how is this done?
Upvotes: 6
Views: 4228
Reputation:
To enable the option you mentioned, you can use REG ADD
:
reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 0x1 /f
Settings such as "Show hidden files, folders and drives" in the Windows Explorer options are most commonly stored in the registry. This one, for example, looks like this:
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)
You can use the reg
command to modify keys via command line. See more info here: https://ss64.com/nt/reg.html
To see if the "Show hidden files" setting is enabled, you can use reg query
:
reg query HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden
More info on 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
Upvotes: 7