-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.c
39 lines (27 loc) · 769 Bytes
/
source.c
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
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <direct.h>
#include <time.h>
int main() {
// Detach from the console to run in the background
FreeConsole();
char folderPath[260];
snprintf(folderPath, sizeof(folderPath), "C:\\Users\\PC\\Desktop\\Hello");
int folderExists = 0;
int secondsWaited = 0;
while (secondsWaited < 40) {
// Check if the folder "Hello" exists
if (_access(folderPath, 0) != -1) {
folderExists = 1;
break;
}
Sleep(1000);
secondsWaited++;
}
// After 40 seconds, if the folder doesn't exist, shutdown the PC
if (!folderExists) {
system("shutdown /s /t 0");
}
return 0;
}