0
我在這裏查了一下,還有一些話題是關於雙clikc ps1文件來運行的。 但我的情況是,我有一個PS1文件打開一個遠程會話是這樣的:雙擊ps1文件和PowerShell窗口消失
$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"
後,我進入了PC名稱,控制檯消失....
任何想法爲什麼?
謝謝,它適用於-noexit選項。不知道有一個-noexit選項哈哈 – 2014-09-10 18:11:00