This is a batch file in Windows.
Here is my .bat file
@echo off
copy \"C:\\Remoting.config-Training\" \"C:\\Remoting.config\"
\"C:\\ThirdPar
I used this to start a cmd file from C#:
Process proc = new Process();
proc.StartInfo.WorkingDirectory = "myWorkingDirectory";
proc.StartInfo.FileName = "myFileName.cmd";
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForExit();
You might be interested in trying my silentbatch program, which will run a .bat
/.cmd
script, suppress creation of the Command Prompt window entirely (so you won't see it appear and then disappear), and optionally log the output to a specified file.
To make the command window of a .bat file that executes a .exe file exit out as fast as possible, use the line @start
before the file you're trying to execute. Here is an example:
(insert other code here)
@start executable.exe
(insert other code here)
You don't have to use other code with @start executable.exe
.
Great tip. It works with batch files that are running a java program also.
start javaw -classpath "%CP%" main.Main
Create a .vbs
file with this code:
CreateObject("Wscript.Shell").Run "your_batch.bat",0,True
This .vbs
will run your_batch.bat
hidden.
Works fine for me.
Using start
works fine, unless you are using a scripting language. Fortunately, there's a way out for Python - just use pythonw.exe
instead of python.exe
:
:: Title not needed:
start pythonw.exe application.py
In case you need quotes, do this:
:: Title needed
start "Great Python App" pythonw.exe "C:\Program Files\Vendor\App\application.py"