Last active
August 29, 2015 13:56
-
-
Save dav-s/9179040 to your computer and use it in GitHub Desktop.
notCmdPhoenix or notCmdv2. This is a successor to my former cmd-like-exe: notCmd.exe.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdlib.h> | |
#include <direct.h> | |
using namespace std; | |
int main() | |
{ | |
string comm = ""; | |
while(true){ | |
getline(cin,comm); | |
if(comm.length()>3&&comm.substr(0,3)=="cd "){ | |
if(comm.substr(3)=="/?"){ | |
system(comm.c_str()); | |
} | |
if(chdir(comm.substr(3).c_str())!=0){ | |
cout << "Invalid cd\n"; | |
continue; | |
} | |
cout << "cd successfull to: " << comm.substr(3)<<"\n"; | |
continue; | |
} | |
system(comm.c_str()); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment