简体   繁体   中英

Batch - start a cmd window with a command, but run in the background

The title says it all: i want to start a cmd window with a command, but i want the window hidden

start cmd.exe /k "my command"

This does what I want, but the cmd window remains open, and upon closing i end the command too. I want to run the cmd.exe in the background. Is it possible?

This question was answered here: How to run a command on the background on Windows?

Basically, you just need the /b option from the start command.

If that does not help, go the VB way, creating a .vbs like this:

Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\Scheduled Jobs\mybat.bat" & Chr(34), 0
Set WinScriptHost = Nothing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM