Mat*_*ert 5 powershell batch-file windows-server-2012-r2
我在这里的 Windows Server 2012 R2 上有一个奇怪的问题,对我来说根本没有任何意义。
我有一个 PowerShell 脚本,它基本上具有以下结构:
Function Something-Different
{
[...]
}
Function Start-Some-Batch
{
Start-Process "K:\Path\To\Batch.cmd"
}
Function Something-Else
{
[...]
}
Something-Different
Start-Some-Batch
Something-Else
Run Code Online (Sandbox Code Playgroud)
但是批处理文件K:\Path\To\Batch.cmd
永远不会被执行!
更多信息和事实:
Start-Process "K:\Path\To\Batch.cmd"
直接从PowerShell控制台的确也没有提供任何输出也不踢批处理脚本$error[0]
执行后为空Something-Else
执行得很好(这意味着Start-Some-Batch
不会阻止 PS 脚本完成其执行)Security Settings
通过组策略来的一百个中的任何一个什么会导致这种奇怪的行为?我在这里没有想法了。
小智 1
这是使用 Powershell v4 对我有用的方法。
PS C:\Scripts> Start-Process cmd -ArgumentList "/c 1.cmd" -WorkingDirectory c:\test4
1.cmd
住在哪里c:\test4
归档时间: |
|
查看次数: |
24799 次 |
最近记录: |