When running a batch file a command prompt windows is appeared. Is there any way to hide this? Or if there is a way to run that with a minimized windows, that also would be a great solution.
-
http://www.howtogeek.com/131597/can-i-run-a-windows-batch-file-without-a-visible-command-prompt/ – crh225 Feb 24 '16 at 16:27
-
http://stackoverflow.com/questions/20755301/how-to-hide-command-prompt-for-batch-file – crh225 Feb 24 '16 at 16:28
1 Answers
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /k dir c:\windows\*.*", 0, false
From Help (https://www.microsoft.com/en-au/download/details.aspx?id=2764)
object WshShell object.
strCommand String value indicating the command line you want to run. You must include any parameters you want to pass to the executable file.
intWindowStyle Optional. Integer value indicating the appearance of the program's window. Note that not all programs make use of this information. [0=hidden 1=normal]
bWaitOnReturn Optional. Boolean value indicating whether the script should wait for the program to finish executing before continuing to the next statement in your script. If set to true, script execution halts until the program finishes, and Run returns any error code returned by the program. If set to false (the default), the Run method returns immediately after starting the program, automatically returning 0 (not to be interpreted as an error code).