windows - C++ Executing CMD Commands -
i'm having serious problem here. need execute cmd command line via c++ without console window displaying. therefore cannot use system(cmd)
, since window display.
i have tried winexec(cmd, sw_hide)
, not work either. createprocess
1 tried. however, running programs or batch files.
i have ended trying shellexecute
:
shellexecute( null, "open", "cmd.exe", "ipconfig > myfile.txt", "c:\projects\b", sw_shownormal );
can see wrong above code? have used sw_shownormal
until know works.
i need this. nothing has come light, , have been trying quite while. advice give great :)
redirecting output own pipe tidier solution because avoids creating output file, works fine:
shellexecute(0, "open", "cmd.exe", "/c ipconfig > out.txt", 0, sw_hide);
you don't see cmd window , output redirected expected.
your code failing (apart /c
thing) because specify path "c:\projects\b"
rather "c:\\projects\\b"
.
Comments
Post a Comment