New
#1
{Programming in C++} Command Prompt
Hello SF members.
Today I started with creating one software like Microsoft Command Prompt.
There will be classic Command Prompt and some shortcuts, like ipconfig, chkdsk and etc.
But I need help with first option : Command Prompt Classic edition.
I want to that option be like normal CMD. Enter command and press enter to execute.
I need this code for command. To enter command and press enter to execute.
I know for command system("command"); , where is command for ex. format c:\.
I typed in code system(command); where command is "string command;" and I have code , "cin >> command;" where I need to enter this command. But that dont work for me. I always good error and that dont work.
I need one working code for this. Can anyone please send it ?
Note : I dont know where to post it. So if subforum is wrong please move it.
Code for my current program :
Thanks in advance.#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
void main(){
string selection;
cout << "Welcome to Command Prompt Extended - v1Beta r0001." << endl;
cout << "Created by Trinty. All rights reserved" << endl;
cout << endl;
cout << endl;
cout << "Enter number for function and press enter !" << endl;
cout << endl;
cout << "1. Enter Command Prompt" << endl;
cout << "2. Shutdown computer (60 sec)" << endl;
cout << "3. Run Disk Check " << endl;
cout << "4. Run ipconfig" << endl;
cout << "5. UNDER CONSTRUCTION !" << endl;
cout << "6. UNDER CONSTRUCTION !" << endl;
cout << "7. Unlock Windows CMD. USE AT YOUR OWN RISK !" << endl;
cout << "8. Add Administrator privileges" << endl;
cout << "9. About" << endl;
cout << "10. Exit" << endl;
cout << endl;
cin >> selection;
cout << endl;
if(selection == "1"){
string command;
cout << "Welcome to Command Prompt Classic edition." << endl;
cout << "Enter command and press enter to execute command" << endl;
cout << endl;
cin >> command;
cout << endl;
_getch();
}
}
Please answer soon.
Trinty :)