Windows Powershell指令碼執行

來源:互聯網
上載者:User

標籤:str   rem   let   數字   dash   html   while   rip   color   

在cmd下執行powershell進入shell模式:Windows下的命令都可以執行如:
date  ping   ipconfig  shutdown -r ipconfig | select-string -pattern 255ipconfig | findstr "Address"
1、執行指令碼準備:Get-ExecutionPolicy你可以選擇使用的執行策略有:Restricted - 指令碼不能運行。RemoteSigned - 本地建立的指令碼可以運行,但從網上下載的指令碼不能運行(除非它們擁有由信任的發行者簽署的數位簽章)。AllSigned – 僅當指令碼由信任的發行者簽名才能運行。Unrestricted – 指令碼執行不受限制,不管來自哪裡,也不管它們是否有簽名。你可以使用下面的cmdlet命令設定PowerShell的執行策略: Set-ExecutionPolicy <policy name> Set-ExecutionPolicy RemoteSigned 2、如何執行指令碼: C:\Scripts\Script.ps1OR.\Script.ps1ORpowershell devicelist.ps1 3、常用指令碼:
while (1) {date >>a.logsleep 2ping baidu.com >>a.log} for($i=0; $i -lt 100;$i=$i+1){Write-Host $iecho "ee"} do {Write-Host $i$i++}while ($i -le 5)
 4、執行python指令碼:
$i = 1while (1) {date >>20171103.logecho "$i">>20171103.log$i++python devicelist.pysleep 10}
-le -gt-eq
http://www.powershellpro.com/powershell-tutorial-introduction/logic-using-loops/http://www.splaybow.com/powershell-2.htmlhttp://zh.wikipedia.org/wiki/Windows_PowerShell#.E6.8A.80.E8.A1.93.E5.9F.BA.E7.A4.8E

Windows Powershell指令碼執行

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.