v5captain
在cmd下执行powershell进入shell模式:
变量定义:$i = 10
$a = ifconfig | findstr "192"
Windows下的命令都可以执行如:
date  ping   ipconfig  shutdown -r 
ipconfig | select-string -pattern 255
ipconfig | findstr "Address"
1、设置执行策略:
Dos窗口下执行powershell进入shell模式后执行Set-ExecutionPolicy RemoteSigned
 
2、执行脚本: 
powershell devicelist.ps1
 
3、常用脚本:
while (1) {
date >>a.log
sleep 2
ping baidu.com >>a.log
}
 
for($i=0; $i -lt 100;$i=$i+1)
{Write-Host $i
echo "ee"
}
 
do {
Write-Host $i
$i++
}
while ($i -le 5)


if(1){echo "AAA"} else{echo "BBB"}

#行注释符使用井号(#);块注释符使用“<#”和 “#>”来引起一段注释
 
4、执行python脚本:
$i = 1
while (1) {
date >>20171103.log
echo "$i">>20171103.log
$i++
python devicelist.py
sleep 10
}
-le 
-gt
-eq

分类:

技术点:

相关文章:

  • 2021-12-26
  • 2022-02-19
  • 2022-01-24
  • 2021-08-05
  • 2021-12-04
猜你喜欢
  • 2022-02-16
  • 2021-11-21
  • 2022-12-23
  • 2021-12-04
  • 2021-10-23
  • 2021-08-04
  • 2021-12-04
相关资源
相似解决方案