【发布时间】:2014-09-10 14:30:04
【问题描述】:
我在这里查看过,有一些主题是在谈论要运行的双 clikc ps1 文件。 但我的情况是我有一个 ps1 文件打开这样的远程会话:
$pw = convertto-securestring -AsPlainText -Force -String xxxxxx
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "xxxx\admin",$pw
$pc = Read-Host -Prompt "Please Enter PC name"
$session = new-pssession -computername $pc -credential $cred
Enter-PSSession $session
我试过this way让它双击运行,
powershell.exe -command "& 'C:\A path with spaces\MyScript.ps1' -MyArguments blah"
输入电脑名称后,控制台消失了……
知道为什么吗?
【问题讨论】:
标签: powershell powershell-2.0 powershell-3.0