Cmd 计算器循环命令

Cmd 计算器循环命令

我还在上学,想捉弄我的朋友。每次我们用电脑时,人们都在不停地按计算器键,所以他们得到的是满屏的计算器。现在我想用 cmd 发出命令来让这个键循环。所以当我激活这个循环时,它会打开计算器,直到我想停止它。有没有什么方法可以发出这样的命令。

我们在 Windows 7 上,我没有管理员命令,但我可以访问 cmd。

答案1

为了一次启动多个计算器,请使用以下命令:

for /L %%a IN(1,1,20) DO start "" "C:\Windows\system32\calc.exe"

for 命令将开始计算 20 次。将 20 更改为任意数字。

答案2

您可以创建一个批处理脚本,其中的内容根据需要重复多次:

C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe
C:\Windows\system32\calc.exe

然后将其保存为 .bat 并执行。它应该会为您在脚本中写的每一行打开一个计算器。

答案3

使用 START 命令异步运行每个程序:

START C:\Windows\system32\calc.exe
START C:\Windows\system32\calc.exe
START C:\Windows\system32\calc.exe

有趣的是创建以下 BATCH 文件(funny.bat):

@echo off
START C:\Windows\system32\calc.exe
funny.bat

相关内容