D
D
Dark_Wanderer7772022-04-10 13:59:26
cmd/bat
Dark_Wanderer777, 2022-04-10 13:59:26

Changing values ​​in the registry via .BATnik (as a switch in one file)?

Comrades, the idea stuck in my brain and I can’t fully implement it, I
decided to make a batch file switch to change the values ​​\u200b\u200bin the registry responsible for displaying desktop icons,
but how to implement it through a conditional operator I can’t catch up
if the value in the registry is 1 then 0
if the value in the registry is 0 then 1

Show REG icons
ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDesktop /t REG_DWORD /d 0 /f
taskkill /F /IM "explorer.exe"
start %windir%\explorer.exe

Hide
REG icons ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDesktop /t REG_DWORD /d 1 /f
taskkill /F /IM "explorer.exe"
start %windir%\explorer.exe

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hint000, 2022-04-10
@Dark_Wanderer777

REG query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDesktop | find "0x1"
if errorlevel 1 (
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDesktop /t REG_DWORD /d 1 /f
) else (
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDesktop /t REG_DWORD /d 0 /f
)
taskkill /F /IM "explorer.exe"
start %windir%\explorer.exe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question