Skip to content

Instantly share code, notes, and snippets.

@dav-s
Last active August 29, 2015 13:56
Show Gist options
  • Save dav-s/9179040 to your computer and use it in GitHub Desktop.
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.
#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