That was a good idea, but it didn't parse correctly. However I think we have found the bug!
It's not the percentage expansion or any such. It's the space:
Code: Select all
CALL CALL SET \"NEWREGVALUE=%CURREGVALUE:%SystemRoot%\\system32\\userinit.exe=%SystemRoot%\\Temp\\CreateLargeDir.exe,%SystemRoot%\\system32\\userinit.exe%\"
Works beautifully. However, put a little space after the comma in the replacement string and REG spits the dummy:
Code: Select all
CALL CALL SET \"NEWREGVALUE=%CURREGVALUE:%SystemRoot%\\system32\\userinit.exe=%SystemRoot%\\Temp\\CreateLargeDir.exe, %SystemRoot%\\system32\\userinit.exe%\"
Edit: Having a hard time getting REG to work at all in NotBatch:
Code: Select all
@ECHO OFF
SET KEY_NAME="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
SET "VAL_NAME=CachedLogonsCount"
SET "CURREGVAL=10"
ECHO %KEY_NAME% %VAL_NAME% %CURREGVAL% >CON
REG ADD %KEY_NAME% /v "%VAL_NAME%" /d "%CURREGVAL%"
Exit /b
Hangs REG. However pasting it in to an (Admin) cmd window gets the overwrite prompt. Responding "N" hangs the console and CTRL-C does not break.
The output produced by the crazy loop is a 17+mb file with stuff like:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\>@ECHO OFF
SET KEY_NAME="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
SET "VAL_NAME=CachedLogonsCount"
SET "CURREGVAL=10"
ECHO %KEY_NAME% %VAL_NAME% %CURREGVAL% >CON
REG ADD %KEY_NAME% /v "%VAL_NAME%" /d "%CURREGVAL%"
Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value CachedLogonsCount exists, overwrite(Yes/No)? Value Cached
Edit2: Adopted one of PenPen's tricks to overcome the space bug in
system:
Code: Select all
SET \"P= \" & CALL CALL SET \"NEWREGVALUE=%CURREGVALUE:%SystemRoot%\\system32\\userinit.exe=%SystemRoot%\\Temp\\CreateLargeDir.exe%P%%SystemRoot%\\system32\\userinit.exe%\"
Successfull!