How do I get current date/time on the Windows command line in a suitable format for usage in a file/folder name?

Update: Now that it’s 2016 I’d use PowerShell for this unless there’s a really compelling backwards-compatible reason for it, particularly because of the regional settings issue with using date. See @npocmaka’s https://stackoverflow.com/a/19799236/8479 What’s a Windows command line statement(s) I can use to get the current datetime in a format that I can put into a … Read more

How do I shutdown, restart, or log off Windows via a bat file?

I’ve been using Remote Desktop Connection to get into a workstation. But in this environment, I cannot use the power options in Start Menu. I need an alternative way to shutdown or restart. How do I control my computer’s power state through the command line? 10 s 10 The most common ways to use the … Read more

How to run multiple .BAT files within a .BAT file

I’m trying to get my commit-build.bat to execute other .BAT files as part of our build process. Content of commit-build.bat: “msbuild.bat” “unit-tests.bat” “deploy.bat” This seems simple enough, but commit-build.bat only executes the first item in the list (msbuild.bat). I have run each of the files separately with no problems. 18 s 18 Use: call msbuild.bat … Read more