I want to run a bat file in background. I searched in google and I found some examples using hstart and cmdow. But Isn't anyway to do this with windows commands? I really feal good when I don't add extra programs to my project ! thanx in advance
Asked
Active
Viewed 1.3k times
5
-
See also http://stackoverflow.com/questions/298562/windows-xp-or-vista-how-can-i-run-a-batch-file-in-the-background-no-windows-dis – VonC Nov 10 '09 at 07:18
3 Answers
8
I'm using window scheduler. I found a way :
Save this one line of text as file invisible.vbs:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
To run any program or batch file invisibly, use it like this:
wscript.exe "C:\Wherever\invisible.vbs" "C:\Some Other Place\MyBatchFile.bat"
thanx
![](../../users/profiles/196572.webp)
AliBZ
- 3,733
- 10
- 41
- 64
1
It really depends on the programming language and platform you are using.
In Windows, using the C# language on the .NET platform, it is:
System.Diagnostics.Process.Start(@"C:\myfile.bat");
![](../../users/profiles/102937.webp)
Robert Harvey
- 168,684
- 43
- 314
- 475
0
You can try to run the batch file as a windows service. You will perhaps need to have admin previleges on your host to do this, but if you want to go for it, its easy to add/configure using sc command.
![](../../users/profiles/55291.webp)
Critical Skill
- 2,458
- 2
- 17
- 21