Discussion:
Run a batch file hidden using plain vanilla C win32
(too old to reply)
John Smith
2018-08-10 09:52:59 UTC
Permalink
How can I open cmd and run a batch file or just execute a batch file without a
command prompt window popping up.

I'd like to do this from plain vanilla C WIN32 source code.

I've been searching the net and most advice to download a small utility or use
VBS interpreter to do it. I don't want to use an extra program - how do they do
it in the first place anyway?
Stefan Ram
2018-08-10 12:21:15 UTC
Permalink
Post by John Smith
I've been searching the net and most advice to download a small utility or use
VBS interpreter to do it. I don't want to use an extra program - how do they do
it in the first place anyway?
Maybe you can use the command "sc" to create the batch as a service?
(I cannot provide further details on how to exactly do this.)
Udo Steinbach
2018-08-10 12:55:22 UTC
Permalink
Are CreateProcess()
https://docs.microsoft.com/en-us/windows/desktop/ProcThread/creating-processes
and ShellExecute()
https://docs.microsoft.com/de-de/windows/desktop/api/shellapi/ns-shellapi-_shellexecuteinfoa
to easy?
--
Fahrradverkehr in Deutschland: http://radwege.udoline.de/
GPG: A245 F153 0636 6E34 E2F3 E1EB 817A B14D 3E7E 482E
JJ
2018-08-10 18:47:42 UTC
Permalink
Post by Udo Steinbach
Are CreateProcess()
https://docs.microsoft.com/en-us/windows/desktop/ProcThread/creating-processes
and ShellExecute()
https://docs.microsoft.com/de-de/windows/desktop/api/shellapi/ns-shellapi-_shellexecuteinfoa
to easy?
Or WinExec()

https://msdn.microsoft.com/en-us/windows/desktop/ms687393

Can't get any more simpler than that.
Like CreateProcess(), it doesn't require SHELL32.DLL either.
Charlie Gibbs
2018-08-11 21:20:50 UTC
Permalink
Post by John Smith
How can I open cmd and run a batch file or just execute a
batch file without a command prompt window popping up.
I'd like to do this from plain vanilla C WIN32 source code.
I've been searching the net and most advice to download a small
utility or use VBS interpreter to do it. I don't want to use an
extra program - how do they do it in the first place anyway?
Call CreateProcess() with si.wShowWindow set to SW_HIDE.
--
/~\ ***@kltpzyxm.invalid (Charlie Gibbs)
\ / I'm really at ac.dekanfrus if you read it the right way.
X Top-posted messages will probably be ignored. See RFC1855.
/ \ Fight low-contrast text in web pages! http://contrastrebellion.com
Loading...