首页 > 解决方案 > 运行文件夹中的所有 .exe

问题描述

我在虚拟机中玩恶意软件,我尝试的每个脚本都卡住了。基本上我需要运行文件夹中的每个 .exe。使用 start、powershell 等尝试了批处理文件。当 AV 将某些文件移动到隔离区或某些进程继续运行然后脚本不会跳转到下一个时,就会出现此问题。

CMD 启动有效,但在找不到某个文件时显示弹出窗口,然后您必须继续单击以跳转到下一个文件。

这些工作但一段时间后卡住了:

Get-ChildItem 'C:\Users\LAB\Desktop\test' | ForEach-Object {
>>   & $_.FullName
>> }

同样在这里:

for %%v in ("C:\Users\LAB\Desktop\test\*.exe") do start "" "%%~v"

和这里:

for %%i in (C:\Users\LAB\Desktop\test\*.exe) do %%i

标签: powershellcmdexe

解决方案


您需要提供某种形式的代码,以便我们帮助您解决问题;这不是请求脚本页面。

无论如何,你会看到这样的东西:

#Assuming the .exe's are located in C Root.
Get-ChildItem -Path C:\ | Where-Object {$_.Extension -like ".exe"}| Foreach {Start-Process $_.FullName}

#In Ps, we like to filter as far left as possible for faster results.
Get-ChildItem -Path C:\ -File "*.exe" | Foreach {Start-Process $_.FullName}

#Running the commands as jobs so it doesnt wait on any to finish before running the next.
Start-Job { Get-ChildItem -Path C:\ -File "*.exe" | Foreach {Start-Process $_.FullName} }
Start-Sleep 2
Get-Job | Remove-Job

请参考以下链接:如何提问


推荐阅读