0

I have following code, I want to hide the EXE window when I execute it from the batch file. Is it possible? Please help. (Run exe in background)

cd "C:\Program Files\MyService\"
start CliServiceCmd.exe
raymelfrancisco
  • 821
  • 2
  • 11
  • 21
Addi Khan
  • 119
  • 12
  • What do you mean by "hide"? Do you mean make it hidden on the file system? Or do you mean so that people don't know which exe you are trying to call via the batch file? Not really possible. You could obfuscate it in code (via some form of string concatenation or a system variable), or refer to it via a link, but if someone has access to your batch file's contents, then they can still theoretically reverse engineer the executable used. What's the use case for this requirement? Why do you need to hide the exe? – ManoDestra Apr 27 '16 at 13:19
  • What the operating system are you running? My machine runs with win7 and I can start my exe without extension, such as `start ffplay test.avi`. It's fine. – Gemini Keith Apr 27 '16 at 13:21
  • basically i have service that run in bat file i have add above code in Batch file and i want to hide run file – Addi Khan Apr 27 '16 at 13:23
  • windows 7 i am using – Addi Khan Apr 27 '16 at 13:23
  • 1
    You can make it as a windows service with different service name from the original file name and call `net start servicename` to start it. – Gemini Keith Apr 27 '16 at 13:25
  • 1
    i have edit my problem – Addi Khan Apr 27 '16 at 13:27
  • 2
    @AddiKhan Do you mean "I want to run an executable that has a window, but prevent the window from being displayed"? If so, you will need to see if your executable has any specific options to permit this. – RB. Apr 27 '16 at 13:28
  • @RB. dear i want run my exe in background.. command window does not show – Addi Khan Apr 27 '16 at 13:28
  • 1
    @GeminiKeith dear i have simple C# console file that i want run in background command window does not show – Addi Khan Apr 27 '16 at 13:29
  • 2
    You could try `start "" "CliServiceCmd.exe"`, with empty "" between `start` and your program. – Gemini Keith Apr 27 '16 at 13:30
  • 3
    If you don't want to spawn a new window, use `start /B`. Alternatively, you can start with the window minimised (`start /MIN`). Or, just don't use start at all! – RB. Apr 27 '16 at 13:30
  • @RB. thanks :) its run that's i want .. post as answer – Addi Khan Apr 27 '16 at 13:32
  • 3
    [check this](http://stackoverflow.com/a/33152424/388389) – npocmaka Apr 27 '16 at 13:33
  • 1
    Possible duplicate of [How to run a command on the background on Windows?](http://stackoverflow.com/questions/21031171/how-to-run-a-command-on-the-background-on-windows) – ManoDestra Apr 27 '16 at 13:42

1 Answers1

6

You can call START with different options

Print help information

START /? 

Run without spawning a new window

START /B MyCommand.exe

Run in a minimized window

START /MIN MyCommand.exe

Alternativaly, just don't use start - launch your exe directly!

RB.
  • 33,692
  • 12
  • 79
  • 121