zyh3033 发表于 2018-9-3 07:00:58

PowerShell脚本简单使用 检测网络状况 date ping

  1.执行权限
  
>>Set-ExecutionPolicy RemoteSigned  RemoteSigned - 本地创建的脚本可以运行,但从网上下载的脚本不能运行(除非它们拥有由受信任的发布者签署的数字签名)
  2.编写脚本
  
while (1) {  

date >>a.logsleep 2  

ping baidu.com >>a.log  

}  保存到一个文件夹内,扩展名为.ps1 如:D:\aa.ps1
  3.运行脚本
  cmd 下执行powershell 或者在开始搜索powershell就可以打开powershell程序
  
  D:\aa.ps1
  或者切换到文件所在目录
.\aa.ps1  


页: [1]
查看完整版本: PowerShell脚本简单使用 检测网络状况 date ping