Have a question on a batch file..

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
anoble1
Posts: 22
Joined: 29 Nov 2012 10:24

Have a question on a batch file..

#1 Post by anoble1 » 05 Mar 2013 09:28

Hi,
I have a batch file that I want to know how it works.

Code: Select all

@echo off & setlocal
cls
:GetPCName
set /p tpc=Enter PCName to apply fix to^[default^:%computername%^]:
cls
if '%tpc%'=='' goto localch
echo Checking if PC is Online..
ping -w 1 %tpc% | find "Reply" > nul
if not errorlevel 1 GOTO online
echo PC dosent seem to be online, Check the ComputerName and try again
echo.
echo.
goto GetPCName
:online
echo detected Value
reg query "\\%tpc%\HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v BufferPolicyReads
reg add "\\%tpc%\HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v BufferPolicyReads /t REG_DWORD /d 1
echo value changed to 1
goto end
:localch
echo detected Value
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v BufferPolicyReads
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v BufferPolicyReads /t REG_DWORD /d 1
echo value changed to 1
:end
pause


Why does it req query twice and reg add twice? And what is the tpc?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Have a question on a batch file..

#2 Post by foxidrive » 05 Mar 2013 09:37

anoble1 wrote:Hi,
I have a batch file that I want to know how it works.

Why does it req query twice and reg add twice? And what is the tpc?


It does it once only - it branches to either routine depending on if the local computer is used or a remote server is specified by typing the computer name/ip address at the prompt.

TPC variable is the remote computer name or IP address.

Post Reply