打入 D:\Learning\PowerShell\Ch02\GetFileShares.ps1
或是
先 cd D:\Learning\PowerShell\Ch02\
再打入 .\GetFileShares.ps1 (即便是在現行作用目錄區中,也要用 .\ )
在啟動 PowerShell 環境時
PowerShell -Noexit -command "D:\Learning\PowerShell\Ch02\GetWmiAndQuery.ps1"
參數
-Noexit:為了保持 PowerShell 的執行結果,能保留下來。
-command:為了是在啟動 PowerShell 時,一併載入指定的批次檔案。
PowerShell Scripts 如何執行?
http://pertonchang.blogspot.tw/2009/05/powershell-scripts.htmlRun as Administrator
Open Powershell first:
Type
PowerShell
to enter a PowerShell session.
Once in the session:
Type
Start-Process PowerShell -Verb RunAs
and press Enter.
That will open a new Powershell process as Administrator.
------- OR -------
To do it all with only one line from the command prompt, just type:
powershell -Command "Start-Process PowerShell -Verb RunAs"
沒有留言:
張貼留言