Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- REM **REFERS TO THE ABOVE** Using @echo off will prevent commands from
- REM **REFERS TO THE ABOVE** printing to the terminal
- REM **REFERS TO THE ABOVE** Only the command results will be printed
- REM.
- REM.
- REM "Setlocal" localizes all variables set within this script.
- REM This means that when this script exits any variables that have been set
- REM using the "set" command will not be remembered.
- SETLOCAL
- REM Sets the title on the title bar of the command prompt window
- title Movie Mode
- REM.
- REM Sets the color of the window and the text within the window.
- REM Use color /? for more details
- color 53
- REM.
- REM Echo prints to text in the command prompt window
- Echo Do you want to activate movie mode or deactivate movie mode (a or d)?
- REM ":ask" is a label used with "goto" to navigate the script
- :ask
- REM.
- REM "Set" is used to set variables within the script
- REM In this case it is setting "MON" to nothing to prevent any previous
- REM values from remaining
- set MON=
- REM.
- REM "Set /P" will prompt the user for input
- REM This will set the variable to the users input after a RETURN
- set /P MON=What will it be (a or d)? %=%
- REM.
- REM "IF /I" will compare "%MON%" (which the user set in the previous
- REM line) to "a" and "d"
- REM The "I" switch in "IF /I" tells the IF command to ignore cAsE
- REM The "goto" command will navigate to the specified label if the
- REM statement was true
- If /I "%MON%"=="a" goto activate
- If /I "%MON%"=="d" goto deactivate
- REM.
- REM This goto command will only be executed when %MON% is not equal to
- REM "A,a,D,d" and will navigate back to the :ask label above
- goto ask
- REM.
- REM Label :Activate is executed only if the user entered A or a
- :Activate
- REM.
- echo Setting monitors to never sleep
- REM Uses the powercfg command to change the monitor timeout in the Windows
- REM power scheme
- REM A value of 0 will force the monitors never to sleep
- powercfg /Change /monitor-timeout-ac 0
- REM.
- goto end
- REM Label :Activate is executed only if the user entered D or d
- :Deactivate
- REM.
- echo Setting monitors to sleep after 15 minutes
- powercfg /Change /monitor-timeout-ac 15
- REM Label :end represents the end of the script
- :end
- REM.
- echo Done! Press any key to exit...
- REM The "pause" command is used to wait for the user to press a key
- REM ">" redirects the standard output of the "pause" command so that it is
- REM not seen. For more information on redirection see
- REM http://www.robvanderwoude.com/redirection.php
- pause>nul
- REM This is all pretty basic batch scripting and was all written in a
- REM hurry and could really be improved in so many ways.
- REM.
- REM.
- REM For /u/save_the_rocks
Advertisement
Add Comment
Please, Sign In to add comment