- Using CMD to search for strings and return next character?
-
The ! (exclaim) char in Batch Scripting
change setlocal to: setlocal disabledelayedexpansion
-
[Help] Batch Scripting System Cleanup
This should help: For /F %%A in ('Attrib /S "%USERPROFILE%\Local Settings\Temporary Internet Files\*" ^| Find /C /V "File not found - "') Do Echo IE Temp Files: %%A For /F "Tokens=3" %%A in ('Reg Query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content" /v CacheLimit') Do Set /A IECacheSize=%%A / 1024 Echo IE Cache Size: %IECacheSize% MB For /F %%A in ('Attrib /S %SYSTEMROOT%\Prefetch\*.pf ^| Find /C /V "File not found - "') Do Echo Windows Prefetch Files: %%A
-
Need Batchfile (rename and export)
The REN and ECHO lines need to be in parenthesis because they are both part of the DO loop. Enclosing lines in parenthesis like that is a way of executing multiple lines of code using commands like IF and DO. An alternative way is to us the '&' character to separate multiple commands like... FOR /F "TOKENS=1,2 DELIMS=-" %%I IN ('DIR /B WINDOWSXP-KB*.EXE') DO REN %%I-%%J*.EXE %%J.EXE & ECHO %CMD% %SOURCE%%%J.EXE %INT%%PATH% >> EXPORT.TXT This must all be on one line. This way makes the code harder for someone else to read (if that matters) but it works all the same.
-
Need Batchfile (rename and export)
This should get you started. It will rename the hotfixes that are in the %SOURCE% directory and output a list to export.txt in your format. SET CMD=START /WAIT SET INT=/Q -INTEGRATE: SET SOURCE=H:\UPDATES\ SET PATH=H:\XPCD\ del export.txt 2>nul for /f "tokens=1,2 delims=-" %%I in ('dir /b %SOURCE%\windowsxp-kb*.exe') do ( ren %SOURCE%%%I-%%J*.EXE %%J.EXE echo %CMD% %SOURCE%%%J.EXE %INT%%PATH%>>export.txt )
-
Command Prompt ignoring $PATH?
Look at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and verify that Path is type REG_EXPAND_SZ. If it's not, it needs to be so delete Path and create a new expandable string value called Path and enter your path. Logoff or reboot to see change take effect.
-
batch file (.bat's) exit command
Another way to get the window to close (without PIFs) is to put this at the end of your batch: cls @exit
-
Print Spooler questions...
net stop spooler net start spoolerThis will work from command prompt or batch file.
-
screen saver program
This will schedule it using cmd prompt: at 20:00 /interactive /every:m,t,w,th,f,s,su cmd /c logon.scr /s
-
screen saver program
Launch with /s switch e.g. logon.scr /s