The problem with that is that if the default has never been changed i.e.0x0, you cannot use COLOR 0. What about: Code: (Set _CLR=07) For /f "tokens=2 delims=x" %%a In ( 'Reg Query "HKCU\Software\Microsoft\Command Processor" /v "DefaultColor"' ) Do If %%a Neq 0 (Set _CLR=%%a) Then use COLOR %_CLR% to set to defaults, or COLOR to set the that which was set when the console opened.
The latest code you've posted isn't working in my VM. I tell it to install and it blanks out, just a flashing _ (underscore.) I try install again, tells me it already is installed. I am placing "ECHO.Marker#1&Pause" in locations to try and find out where it stops working.
In the ReinstallIR7 Section The following sequence should be replaced… Code: echo schtasks /create /tn "Key" /tr "%SystemDrive%\Trial\IR7.bat" /sc onlogon /ru "" ^>nul >>%SystemDrive%\Trial\IR7\IR7.bat echo REG SAVE HKLM\SYSTEM %TEMP%\SYSTEM.HIV /y >NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo REG RESTORE HKLM\SYSTEM %TEMP%\SYSTEM.HIV >NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo del %TEMP%\SYSTEM.HIV >NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo POWERSHELL -command rename-item HKLM:\SYSTEM\WPA -NewName WPA_Delete >NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo REG DELETE HKLM\SYSTEM\WPA_Delete /f >NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo schtasks /delete /tn "Msgbox" /f ^>nul>>%SystemDrive%\Trial\IR7\IR7.bat echo del /F /Q %SystemDrive%\Trial\Msgbox.bat ^>nul>>%SystemDrive%\Trial\IR7\IR7.bat with this to correct the nesting problems you still haven't fully addressed! Code: echo schtasks /create /tn "Key" /tr "%%SystemDrive%%\Trial\IR7.bat" /sc onlogon /ru "" ^>nul >>%SystemDrive%\Trial\IR7\IR7.bat echo REG SAVE HKLM\SYSTEM %%TEMP%%\SYSTEM.HIV /y ^>NUL 2^>^&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo REG RESTORE HKLM\SYSTEM %%TEMP%%\SYSTEM.HIV ^>NUL 2^>^&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo del %TEMP%\SYSTEM.HIV ^>NUL 2^>^&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo POWERSHELL -command rename-item HKLM:\SYSTEM\WPA -NewName WPA_Delete ^>NUL 2^>^&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo REG DELETE HKLM\SYSTEM\WPA_Delete /f ^>NUL 2^>^&1 >>%SystemDrive%\Trial\IR7\IR7.bat echo schtasks /delete /tn "Msgbox" /f ^>nul >>%SystemDrive%\Trial\IR7\IR7.bat echo del /F %%%%0 ^>nul >>%SystemDrive%\Trial\IR7\IR7.bat Try implementing it and seeing if it helps.
The only references to system32 in that code would be from the scheduled tasks, are you sure they have run? Incidentally in the /TR section of the scheduled task, system32 is assumed if the path is not given so you should be able to shorten those two lines accordingly. From: Code: echo schtasks /create /tn "IR7" /tr "'%%SystemDrive%%\Windows\system32\cmd.exe' /c cscript.exe /b C:\Windows\System32\slmgr.vbs /rearm && net stop sppsvc && net start sppsvc" /sc daily /mo 30 /ru "" /f ^>nul >>%SystemDrive%\Trial\IR7\IR7.bat To: Code: echo schtasks /create /tn "IR7" /tr "cmd /c cscript /b slmgr.vbs /rearm && net stop sppsvc && net start sppsvc" /sc daily /mo 30 /ru "" /f ^>nul >>%SystemDrive%\Trial\IR7\IR7.bat and From: Code: schtasks /create /tn "IR7" /tr "'%SystemDrive%\Windows\system32\cmd.exe' /c cscript.exe /b %SystemDrive%\Windows\System32\slmgr.vbs /rearm && net stop sppsvc && net start sppsvc" /sc daily /mo 30 /ru "" /f >nul To: Code: schtasks /create /tn "IR7" /tr "cmd /c cscript /b slmgr.vbs /rearm && net stop sppsvc && net start sppsvc" /sc daily /mo 30 /ru "" /f >nul There is something in the code which will always generate an error, a harmless one but an error always appears as the console closes. Change this line: Code: echo echo del /F /Q %%%%0^^^>nul^>^>%%systemdrive%%\Trial\IR7.bat>>%SystemDrive%\Trial\IR7\IR7.bat to this for a fix: Code: echo echo start /b cmd /c del "%%%%~f0"^^^&exit /b ^>^>%%systemdrive%%\Trial\IR7.bat >>%SystemDrive%\Trial\IR7\IR7.bat
If you've only provided an OK button then the return value, (ERRORLEVEL), when pressed will be 1 EDIT Because you only have one option for that box, 1 will always be returned! So you could just remove the %ERRORLEVEL% line and go straight to the DELETE and SHUTDOWN lines!
I executed the bat script on my computer and my trial went down to 3 days from 8 days... What did I do wrong?