![]() ![]() Also start with smaller programs and don't try using every function (input, math, choices etc.) in your first programs. If you don't know what something means google helps for most batch problems. Example code which waits for 5 seconds: ping -n 5 localhost>nul Because we don't need the command's output we discard it using >nul. ![]() There is not dedicated command to wait for some seconds but you can use the ping-command as one ping always takes one second. To change the size of the console window you can use the mode-command: mode con cols=60 lines=10 ![]() Check out this page for more information on popup messages and inputs. Using additional applications or VBScripts you can show popups. It is not possible to use popups to ask the user for input with the standard batch commands. Set /P minutes="Enter shutdown delay in minutes: "Įcho Press any key to cancel the shutdown REM Ask the user for input and convert minutes to seconds It then stops the shutdown, if any key is pressed. It asks the user for input in minutes and converts the input to seconds to start the shutdown. Here is a quick batchscript I put together. If "%forced%" = "%forced%" goto forcedconfirmĮcho %hour% Hours %min% Minutes %sec% SecondsĪlso, what on earth does the above code even do? If "%image%" = "%image%" goto imageconfirm If "%taskkill%" = "%taskkill%" goto taskkillconfirm Also, with a much smaller cmd box, if possible? off (Optional: somehow incorporate an abort shutdown feature into the same batch file.)Įdit: Similar to the following code, except it shuts down the computer once the timer is up. I've seen it done, but the cmd window is large and bulky. The batch file then force-closes all open programs, and shuts down after 300 seconds (5 mins).Īdditionally, can the batch file have some form of timer built in? bat file, and is presented with a pop-up window asking for how long until the shutdown. Now, I'm not very techy myself, but here's how I imagine this: A user runs the. bat file that shuts the computer down after querying the user (via pop-up or otherwise) for how many minutes until the shutdown. I've got the obvious answer, which is: shutdown -s -f -t 120īut say I want to shut down not after two minutes, but five, or ten? I'm looking for a batch file code that shuts down a computer after a certain amount of time. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |