powershell - 运行文件夹中的所有 .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
解决方案
您需要提供某种形式的代码,以便我们帮助您解决问题;这不是请求脚本页面。
无论如何,你会看到这样的东西:
#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
请参考以下链接:如何提问
推荐阅读
- r - R Shiny:来自函数的反应值
- android - 如何找到破坏服务的原因
- tensorflow - 如何构建 tensorflow lite benchmark_model?
- django - django many_to_many 字段删除
- r - 如何在 dplyr 的过滤器中正确使用 all?
- r - 错误 data.frame:未定义的列选择,闪亮的 R,lapply()
- arrays - 使用 mongodb 获得条件总和
- python - decorator on slot (PyQt)
- git - 在 android studio 中签出 Gitlab 的私有项目时身份验证失败
- c++ - 是否允许用不同的类型替换 `this`?