1

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?

Joe96
  • 17
  • 1
  • 1
  • 6
  • Using `start /min "" "cmd.exe" "echo I look amazing etc.."` you can start a cmd window minimized, but as for completely hidden @user3558618 has the answer with the `/b` option. – Bloodied Mar 23 '16 at 17:38
  • Are you sure you want to use the `/K` option - the background process will never end. I think you want to use `/C` instead. – dbenham Mar 24 '16 at 01:50

1 Answers1

3

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
Community
  • 1
  • 1
Victor Silva
  • 306
  • 2
  • 15
  • Just make sure your background process does not mess with stdin, stderr, or stdout. Or make sure you redirect the standard I/O to/from files. Otherwise things become very confusing when you run in the same window with `/B`. – dbenham Mar 24 '16 at 01:47