Run cmd.exe in background

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am running cmd.exe from within my program to call other programs and run
batch files.
I use /c to start the programs and /q to turn echo off

What I cannot stop is the command prompt window from displaying while the
calld program/batch is running

Can this be achieved?
 
DerekT said:
I am running cmd.exe from within my program to call other programs and run
batch files.
I use /c to start the programs and /q to turn echo off

What I cannot stop is the command prompt window from displaying while the
calld program/batch is running

Can this be achieved?

You can launch the program via the Task Scheduler.
If you start it under an account other than your logon
account then the task will be completely invisible.
 
Not sure that TS is what I can use.
I think I need to give a bit more of an explanation.
The programs/batches I need to run are on an ad-hoc basis not at any preset
day/time.
They are called typically from the click code of a button using an internal
function from my IDE i.e.
exeshell( cmd.exe /c/q myprogram.exe [bunch of params to
myprogram])

This all works fine except for the command prompt window showing (either
full or iconized) whilst the program/batch runs.
I just want to hide this as asthetically it looks better and it stops
unwanted "this strange window keeps appearing when" questions from users.

The solution, if there is one, needs to be one that can be programmed.

Regards
 
This is easy to program. You could do this:
- The click of your shortcut will generate two files, in this order:
1. The batch file c:\tools\launch.bat with these lines inside:
myprogram.exe [bunch of params to myprogram])
del c:\tools\go.txt
2. The semaphore file c:\tools\go.txt
- The task scheduler runs a batch file once every 5 minutes.
It checks for the existence of c:\tools\go.txt. If the file
exists then it will invoke c:\tools\launch.bat.

DerekT said:
Not sure that TS is what I can use.
I think I need to give a bit more of an explanation.
The programs/batches I need to run are on an ad-hoc basis not at any preset
day/time.
They are called typically from the click code of a button using an internal
function from my IDE i.e.
exeshell( cmd.exe /c/q myprogram.exe [bunch of params to
myprogram])

This all works fine except for the command prompt window showing (either
full or iconized) whilst the program/batch runs.
I just want to hide this as asthetically it looks better and it stops
unwanted "this strange window keeps appearing when" questions from users.

The solution, if there is one, needs to be one that can be programmed.

Regards


Pegasus (MVP) said:
You can launch the program via the Task Scheduler.
If you start it under an account other than your logon
account then the task will be completely invisible.
 
Back
Top