main.cpp
1 #include <iostream> 2 #include <sys/stat.h> 3 #include <stdlib.h> 4 #include <string> 5 6 using namespace std; 7 8 int main ( int argc, char* argv[] ) { 9 struct stat s; 10 if ( !stat ( argv[1], &s ) && s.st_mode & S_IFDIR ) { 11 string str = "C:\\Windows\\explorer.exe "; 12 str += argv[1]; 13 system ( str.c_str() ); 14 return 0; 15 } 16 cout << "Examples: \n\te .\tOpen current directory with 'Windows Explorer'." << endl; 17 return -1; 18 }