Jump to content
  • Advertisement
Sign in to follow this  
SAE Superman

Run console command in Windows without console...

This topic is 5009 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to run a system command in a windows program without having a console window popup to run it? I need to run a batch file but don't want a console window to popup... Thanks in advance [grin]

Share this post

Link to post
Share on other sites
Sure, just execute the console application from a console-less application.

There's probably an easy way to do it without writing custom applications too (rundll perhaps?), but I didn't bother googling last time I needed to do this.
You could probably pipe the output onto some other application too. But the MSVC debugger would only let me spawn raw executables (no batch files or input redirection) and I wanted a way to launch emulated executables.
#include <windows.h>

int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR cmdline, int cmdshow)

ZeroMemory(&si, sizeof(si));
ZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);

if(!CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
return 1;

WaitForSingleObject(pi.hProcess, INFINITE);

return 0;

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!