I'm getting a strange issue with the REG command. If I run the REG command from a batch file, regardless of the syntax, the file will freeze, causing me to have to Control-C my way out, press the red X multiple times, or end the CMD.EXE processes from Task Manager. If I press the red X, the file shows loads of "^C" commands being executed and will sometimes say "The process tried to write to a nonexistent pipe." I usually have to press the X multiple times for the window to actually close.
The same commands typed into a CMD window will run as expected, however. Running the batch file from a CMD window will yield the same results as double-clicking the batch file.
I have not modified anything in the registry but this one value (shown below) which is used for sending messages via MSG.EXE.
Please note that this issue was not occurring earlier today and that this file works on my other Windows 7 machine. Here is the file:
Code: Select all
@ECHO OFF
FOR /F "TOKENS=3" %%a IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" ^| FIND "AllowRemoteRPC"') DO SET REG=%%a
IF /I "%REG%"=="0x1" (ECHO The value is already set to 1.
PAUSE
EXIT /B
)
IF /I "%REG%" NEQ "0x1" REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /V "AllowRemoteRPC" /T REG_DWORD /D 1 /F
ECHO The value is now set to 1.
PAUSE
EXIT /B
