Execute PowerShell under CMD into shell mode: commands under Windows can be executed such as:
Date ping ipconfig shutdown-Select-string255" Address"
1, execute script preparation: Get-executionpolicy You can choose to use the execution policy is: Restricted-script cannot run. remotesigned-Scripts created locally can run, but scripts downloaded from the Web cannot run (unless they have a digital signature signed by a trusted publisher). allsigned– can only be run if the script is signed by a trusted publisher. unrestricted– script execution is unrestricted, regardless of where it comes from and whether or not they have a signature. You can use the following cmdlet command to set the execution policy for PowerShell: Set-executionpolicy <policy name> set-executionpolicy remotesigned 2, How to execute script: C:\Scripts\Script.ps1OR.\Script.ps1ORpowershell devicelist.ps1 3, Common script:
while(1) {Date>>A.logsleep2Ping baidu.com>>A.log} for($i =0; $i-lt -; $i = $i +1) {Write-Host $iecho"ee"} Do{Write-Host $i $i++} while($i-le5)
4. Execute Python script:
1 while (1>>20171103"$i">>20171103 . log$i++}
-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 Script execution