Return to Snippet

Revision: 66088
at March 12, 2014 10:22 by deanhouseholder


Initial Code
@set @junk=0 /* This line is ignored by both Batch and VBS Interpreters.  This starts the Batch portion:
@echo off
cscript //nologo //e:jscript "%~f0" %~1
goto :eof

Jscript part begins here */
WSH.Sleep(WScript.Arguments.Item(0));

Initial URL

                                

Initial Description
In DOS/cmd batch scripts it is not possible to issue a SLEEP command for less than 1 second.  This script allows you to use a single batch script to double as a jscript (double-execution) in order to accomplish a single script/command that can specify sleep in milliseconds.

Usage:

Save script as a filename (not sleep.bat) such as millisleep.bat and put it in your path.

From within another batch script invoke it and pass in the number of milliseconds to sleep:  (example below will sleep 250 milliseconds, which is 1/4th of a second)

millisleep.bat 250

Initial Title
Batch script - sleep in milliseconds

Initial Tags

                                

Initial Language
DOS Batch