How can I hide ms-dos window when running a .bat file?

7,014

Solution 1

You can hide the window with a VB script:

Set objArgs = WScript.Arguments
For Each strArg in objArgs
    Set WshShell = CreateObject("WScript.Shell")
    cmds=WshShell.RUN(strArg, 0, False)
    Set WshShell = Nothing
Next

start c:\runHidden.vbs "C:\wamp\bin\php\php5.4.3\php.exe -f 'C:\wamp\www\tst\index.php'"

Solution 2

You can use start /min <your command> which will not hide window but will minimize it.

Share:
7,014

Related videos on Youtube

prestack
Author by

prestack

Updated on September 18, 2022

Comments

  • prestack
    prestack over 1 year

    I am running a .bat file for my script (Scheduled Tak (CronJob)) per minute. When it run, seems ms-dos window short period of time. My batch code like this;

    @ECHO OFF C:\wamp\bin\php\php5.4.3\php.exe -f "C:\wamp\www\tst\index.php"

    How can I hide this window when it run?

  • Raúl Salinas-Monteagudo
    Raúl Salinas-Monteagudo about 5 years
    Could you please clarify your proposal?
  • Misha Taylor
    Misha Taylor over 3 years
    It quickly hides it. Might just use a compiler instead. This is very old stuff I did.