-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfk-for-git.cpp
58 lines (51 loc) · 1.93 KB
/
sfk-for-git.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
#include <windows.h> //for based code
#include <lmcons.h>
#include <conio.h> //_getch()
using namespace std;
void exec(string strong)
{
const char* comchar = strong.c_str();
system(comchar);
}
int main()
{
unsigned short choice;
string uname;
string comstr;
system("title .sfk Remover @quattroformaggi & color 0e");
cout << "Part 1: Choose one of the basic directories:" << endl << "[1] Desktop" << endl << "[2] Downloads" << endl << "[3] Videos" << " -> ";
cin >> choice;
if ((choice != 1) && (choice != 2) && (choice != 3)) //
{
system("cls");
cerr << "Error with the choice input: a digit between 1-3 needs to be chosen, otherwise this error appears. Shutting down..." << endl;
_getch();
return -1;
}
///////////////////////////////////////////based code
TCHAR username[UNLEN + 1];
DWORD size = UNLEN + 1;
if (GetUserName((TCHAR*)username, &size))
wcout << L"Your username is: {" << username << L"}" << endl;
else
{
system("cls");
cerr << "Error with the username unput, probably you don't have one? Shutting down..." << endl;
_getch();
return -2;
}
///////////////////////////////////////////
cout << "Part 2: To confirm the start of the removing process, enter the username above: ";
cin >> uname; //could be implemented better
switch (choice)
{
case 1: {comstr += "cd /d \"C:\\users\\" + uname + "\\desktop\" & dir & del /p *.sfk & echo."; exec(comstr); break; }
case 2: {comstr += "cd /d \"C:\\users\\" + uname + "\\downloads\" & dir & del /p *.sfk & echo."; exec(comstr); break; }
case 3: {comstr += "cd /d \"C:\\users\\" + uname + "\\videos\" & dir & del /p *.sfk & echo."; exec(comstr); break; }
}
cout << "Executed. Press any key to quit." << endl;
_getch();
system("cls");
return 1;
}