当前位置:网站首页>C language to realize computer automatic shutdown program -- it can be used to spoof roommate's computer

C language to realize computer automatic shutdown program -- it can be used to spoof roommate's computer

2022-06-09 20:28:00 Beans from Java

The realization of computer shutdown mainly uses shutdown command

shutdown command

shutdown -a  Cancel shutdown

shutdown -s    To turn it off

shutdown -f  Forcibly close the application

shutdown -m \\ Computer name   Control remote computer

shutdown -i  Show “ Remote shutdown ” Graphical user interface , But it has to be Shutdown The first parameter of

shutdown -l  Logout the current user

shutdown -r  Shut down and restart

shutdown -s -t Time   Set shutdown countdown

shutdown -r -t Time Set restart countdown

shutdown -h Sleep

This procedure mainly uses shutdown -s -t Time and shutdown -a To achieve

// Use a loop to achieve 
int main()
{
	char arr[20];   // It is used to store the symbols entered when canceling the shutdown 
	system("shutdown -s -t 60");    // To turn it off , Set up 60s Power off after 
	while (1)
	{
		printf(" The computer 60 Shut down in seconds , To cancel , Please enter sos\n");
		scanf("%s", arr);
		if (0 == strcmp(arr, "sos"))
		{
			system("shutdown -a");      // If the input symbol is sos, Then cancel the shutdown 
			break;
		}
	}
}

Running results

Input sos, Cancel shutdown

A spoof :

PC local search “ service ”, take .exe Add files to , Change to auto start , So every time the computer is turned on , That is, the operating system starts , It will automatically shut down within the set time , Unless you enter a symbol set in advance

reminder : Proper Entertainment , Proper Entertainment , Don't play too much !!!

原网站

版权声明
本文为[Beans from Java]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206091918274759.html