Bat Codes
Bat Codes
1. Force shutdown computer@ECHO OFF
ECHO Shutdown Windows..
PAUSE
SHUTDOWN -S -T 0 -F
2. Force Windows to restart
@ECHO OFF
ECHO Restarting Windows..
PAUSE
SHUTDOWN -R -T 0 -F
3. Force Windows to logoff
@ECHO OFF
ECHO Logoff current user
PAUSE
SHUTDOWN -L -T 0 -F
Description: Shutdown is a Command and rest of the line are parameters. The parameter -s indicates 'shutdown'. Parameter '-l' indicates 'logoff' and parameter '-r' indicates 'restart'. The remaining parameters are '-t' and '-f'. Here '-t' sets timeout(here it is zero) and '-f' is used to force all running programs to close
4. Show a message box
@ECHO OFF
MSG * HELLO - TESTING BAT CODE, WORKING!?
Description:
The text after * (asterisk) will be shown in the message box.
5. Clean temporary files
@ECHO OFF
ECHO This will delete all files in user Temp folder and windir temp folder and prefetch folder
PAUSE
DEL /F /S /Q %TEMP%
DEL /F /S /Q %WINDIR%\TEMP
DEL /F /S /Q %WINDIR%\PREFETCH
Description:
'Del' is a command and '/f /s /q' are parameters indicating 'force', 'subdirectories', 'quiet mode' respectively. %temp%, %windir% etc are common windows directories.
5. Hibernate Windows
@ECHO OFF
ECHO Hibernate Windows. All Tasks will be saved as it is and reloaded next time when you switci on the computer.
PAUSE
RUNDLL32.EXE POWERPROF.DLL,SetSuspendState
Description:
Rundll32.exe is a program which calls a dll function from given dll file. Here we are calling the function 'SetSuspendState' from 'powerprof.dll'
Comments
Post a Comment