小编Bla*_*ite的帖子

脚本将其他脚本调用为 .ps1,但不使用 ps2exe 作为 .exe

$password = ConvertTo-SecureString \xe2\x80\x9cPassword+++\xe2\x80\x9d -AsPlainText -Force\n$Cred = New-Object System.Management.Automation.PSCredential ("Admin", $password)\n$FileLocale = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition\nWrite-Output $FileLocale\n$AntFile = "$FileLocale\\StartApps.ps1"\nWrite-Output $AntFile\nStart-Process PowerShell.exe -ArgumentList "-command &$AntFile -UserCredential $Cred"  \n
Run Code Online (Sandbox Code Playgroud)\n

嗨,该代码在 .ps1 中运行,我调用另一个脚本,他完成了他的工作。但是当我在 ps2exe 的帮助下将其转换为 .exe 时,他不再做他的工作了。作为管理员与否。这不是我第一次使用该启动进程,但这是我第一次使用变量作为命令的目标。有谁知道 ps1 和 exe 之间出了什么问题吗?

\n

谢谢

\n

powershell exe start-process ps1 ps2exe-gui

7
推荐指数
1
解决办法
766
查看次数

标签 统计

exe ×1

powershell ×1

ps1 ×1

ps2exe-gui ×1

start-process ×1