Support Forums
How do i perform Window commands? - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Programming with C++ (https://www.supportforums.net/forumdisplay.php?fid=20)
+---- Thread: How do i perform Window commands? (/showthread.php?tid=1566)



How do i perform Window commands? - SylverTech - 10-15-2009

i started learning c++ 2 months ago but i still haven't figured out how to do the MSDOS commands from c++ (i know the "call" command)
like for example changing the password of the current user and so forth


RE: How do i perform Window commands? - charnet3d - 10-17-2009

(10-15-2009, 01:58 PM)SylverTech Wrote: i started learning c++ 2 months ago but i still haven't figured out how to do the MSDOS commands from c++ (i know the "call" command)
like for example changing the password of the current user and so forth

what I know is that you can use system("any_dos_command_here"), try and see if it works for you, but you have to include cstdlib.h


RE: How do i perform Window commands? - mon3yexploit - 10-17-2009

is this anything google cant answer? i know people are scared of Google but this is ridiculous


RE: How do i perform Window commands? - nevets04 - 10-17-2009

Did someone else post this, some whos account was closed? Is this the same person?


RE: How do i perform Window commands? - HatredTrinity - 10-19-2009

(10-15-2009, 01:58 PM)SylverTech Wrote: i started learning c++ 2 months ago but i still haven't figured out how to do the MSDOS commands from c++ (i know the "call" command)
like for example changing the password of the current user and so forth

What I think your trying to do is use window's commands from command prompt?

Try using the
Code:
system();
command. An example would be an MS ping command.

Code:
#include <iostream>
using namespace std;

int main()
{
    cout << "This is a ping test.";
    system("ping www.google.com");
    return 0;
}

Hope this helps!

-Trinity Blackhat


RE: How do i perform Window commands? - charnet3d - 10-20-2009

that's what I told him ^^


RE: How do i perform Window commands? - Jimmyg22 - 10-20-2009

the thing with the system command is every time you run a new system () call it creates a new shell, so doing something like
Code:
int main ()
{
     system ("cd /D C:\\");
     system ("cd");
     system ("pause >nul");
}
instead of printing out C:\ for the second system call it would still print the working directory of the program.


RE: How do i perform Window commands? - charnet3d - 10-21-2009

Oh yeah you're right, but is there any alternative ??


RE: How do i perform Window commands? - MrD. - 10-22-2009

Call a batch file from C++, that should allow you to run multiple commands in the same shell.