MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. ×
Search the Community
Showing results for tags 'automation'.
Hi guys. I need a little help here. I was searching for some batch script to do some tasks on windows 7, 8 and 10 machines and I found some interesting topic. I grab the script and I made some changes. Now I need to make the script to work and I need your help to make the changes I wrote on the script itself. If possible, please, jaclass or somebody else, help me.. The sketch for the script is: IMPORTANT: Whe the user run this script it must get elevate privilegies automaticaly (as run as administrator do). ECHO """BATCH SCRIPT TO CLEAN THINGS!!! "This script will clean things from your computer. Press Y to continue or N to cancel.." If the user type Y then show the message above and continue with the script: "Message: Doing the things. This can take a little.." @ECHO OFF SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION SET /A Counter=0 FOR %%A IN ( "c:\windows\prefetch\*.*" "c:\windows\temp\*.*" "c:\windows\tmp\*.*" "c:\tmp\*.*" "c:\temp\*.*" "c:\WINDOWS\ShellIconCache\*.*" "c:\Users\%username%\AppData\Roaming\Microsoft\Windows\Recent Items\*.*" "%userprofile%\Cookies\*.*" "%UserProfilePath%\Local Settings\Temp\" "%UserProfilePath%\Local Settings\Temporary Internet\*.*" "%UserProfilePath%\Application Data\Sun\Java\Deployment\cache\*.*" "%UserProfilePath%\AppData\LocalLow\Sun\Java\Deployment\cache\*.*" "%UserProfilePath%\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*" "%UserProfilePath%\AppData\Local\Temp\*.*" "%UserProfilePath%\AppData\LocalLow\Temp\*.*" "%homepath%\Appdata\Local\Temp\*.*" "c:\temp\*.*" "%homepath%\Local Settings\Temporary Internet Files\*.*" "%homepath%\Local Settings\Temp\*.* ) DO ( CALL :do_count %%A CALL :do_del %%A ) GOTO :EOF :do_count FOR /F %%B IN ('dir /b %1') DO ( SET /A Counter+=1 ECHO !Counter! ) GOTO :EOF :do_del ECHO del %1 GOTO :EOF When everything is done show a message to the user asking him to reboot the system: "Message: All task where done. Now, please, type R to reboot the computer or L to do it later.." Thats it. If mistakes where made, please correct and show me whats wrong so I can learn too. DEdit.: OH!!! It would be nice if the script could show messages when the task get done, one by one, like: Clean of "c:\windows\temp\*.*": DONE! Clean of ""c:\windows\tmp\*.*": DONE! and so on... :3