Running a CMD or BAT in silent mode

前端 未结 11 1016
夕颜
夕颜 2020-11-28 03:51

How can I run a CMD or .bat file in silent mode? I\'m looking to prevent the CMD interface from being shown to the user.

11条回答
  •  有刺的猬
    2020-11-28 04:15

    I think this is the easiest and shortest solution to running a batch file without opening the DOS window, it can be very distracting when you want to schedule a set of commands to run periodically, so the DOS window keeps popping up, here is your solution. Use a VBS Script to call the batch file ...

    Set WshShell = CreateObject("WScript.Shell" ) 
    WshShell.Run chr(34) & "C:\Batch Files\ mycommands.bat" & Chr(34), 0 
    Set WshShell = Nothing 
    

    Copy the lines above to an editor and save the file with .VBS extension. Edit the .BAT file name and path accordingly.

提交回复
热议问题