Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do i perform Window commands?
#1
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
Reply
#2
(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
Reply
#3
is this anything google cant answer? i know people are scared of Google but this is ridiculous
Reply
#4
Did someone else post this, some whos account was closed? Is this the same person?
Reply
#5
(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
Reply
#6
that's what I told him ^^
Reply
#7
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.
Reply
#8
Oh yeah you're right, but is there any alternative ??
Reply
#9
Call a batch file from C++, that should allow you to run multiple commands in the same shell.
[Image: sig.php]
The little boat gently drifted across the pond exactly the way a bowling ball wouldn't.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)