在cmd下执行powershell进入shell模式:
变量定义:$i = 10
$a = ifconfig | findstr "192"
Windows下的命令都可以执行如:
date  ping   ipconfig  shutdown -r
ipconfig | select-string -pattern
ipconfig | findstr "Address"
1、设置执行策略:
Dos窗口下执行powershell进入shell模式后执行Set-ExecutionPolicy RemoteSigned
 
2、执行脚本: 
powershell devicelist.ps1
 
3、常用脚本:
while () {
date >>a.log
sleep
ping baidu.com >>a.log
} for($i=; $i -lt ;$i=$i+)
{Write-Host $i
echo "ee"
} do {
Write-Host $i
$i++
}
while ($i -le ) if(1){echo "AAA"} else{echo "BBB"} #行注释符使用井号(#);块注释符使用“<#”和 “#>”来引起一段注释
 
4、执行python脚本:
$i =
while () {
date >>.log
echo "$i">>.log
$i++
python devicelist.py
sleep
}
-le
-gt
-eq

Windows Powershell脚本执行的更多相关文章

  1. 使用Windows任务计划程序运行Windows PowerShell脚本

    创建计划任务以运行PowerShell脚本 我需要创建一个计划任务来运行Windows PowerShell脚本的第一件事是我将执行的命令行.找到这个的简单方法是使用Run 命令.有时,我需要知道什么 ...

  2. 【黑客基础】Windows PowerShell 脚本学习(上)

    视频地址:[黑客基础]Windows PowerShell 脚本学习 2019.12.05 学习笔记 1.$PSVersionTable :查看PowerShell的版本信息. 2.PowerShel ...

  3. powershell脚本执行绕过powershell下脚本执行限制(cmd下执行)以及在cmd下隐藏脚本窗口

    powershell脚本执行绕过powershell下脚本执行限制(cmd下执行) powershell脚本运行方式有两种,一种是powshell中运行,另一种是在cmd中(在某些情况下相当有用) p ...

  4. PowerShell 脚本执行策略

    为防止恶意脚本的执行,PowerShell 中设计了一个叫做执行策略(Execution Policy)的东西(我更倾向于把它叫做脚本执行策略).我们可以在不同的应用场景中设置不同的策略来防止恶意脚本 ...

  5. Powershell脚本执行权限

    Powershell脚本需要使用PS1扩展名 在加载脚本前需要确认是都有执行权限,默认是Restricted(受限的), 可以执行Get-ExecutionPolicy查看权限, 一般情况下使用 Re ...

  6. windows slaver 脚本执行xcopy 报错无效驱动器规格

    jenkins上配置的windows slaver机器如下: 我用这台windows 机器作为slaver机器来编译pc的exe包,但是在最后归档包倒ftp上时报错,如下: 但是我直接在windows ...

  7. 【SharePoint学习笔记】第2章 SharePoint Windows PowerShell 指南

    快速了解Windows PowerShell     从SharePoint 2010开始支持PowerShell,仍支持stsadm.exe工具:     可以调用.NET对象.COM对象.exe文 ...

  8. SharePoint 2010 最佳实践学习总结------第2章 SharePoint Windows PowerShell指南

    第2章 SharePoint Windows PowerShell指南 SharePoint 2010是SharePoint系列产品中第一个开始支持Windows PowerShell的产品,在以前的 ...

  9. 如何在windows计划中调用备份sharepoint2010网站集的powershell脚本

    最近有个项目需要在在windows计划中使用powershell脚本备份sharepoint2010网站集,打开sharepoint的powershell执行命令管理界面的属性 查看: C:\Wind ...

随机推荐

  1. WORD分栏后左右都能编辑

    操作如下: 如果是office的请参照:https://zhidao.baidu.com/question/403577041.html 如果是WPS:1.点击插入,有一个分页,点击之后下面有一个可选 ...

  2. 关系型数据库工作原理-事务管理(二)(翻译自Coding-Geek文章)

    本文翻译自Coding-Geek文章:< How does a relational database work>. 原文链接:http://coding-geek.com/how-dat ...

  3. Firefox扩展安装

    firefox扩展和chrome扩展非常相似,甚至兼容.因总结过chrome扩展的开发,这里不提,本篇谈谈firefox扩展的安装. 1.打包 所谓的打包,就是压缩,利用普通的右键压缩文件夹,这样形成 ...

  4. jdk,maven,tomcat 的环境配置

    一般的下载,我想就不用我多说什么了,mysql的配置在mysql压缩包安装方式上,这里直接贴图,下次要是忘记了可以看一眼. 这两个是直接新建的,打开方式为我的电脑,右键:属性,左侧:高级系统设置,下侧 ...

  5. 24.Django路由规则

    路由规则 1.基于正则的url 在templates目录下创建index.html.detail.html文件 (1)index.html <!DOCTYPE html> <html ...

  6. JVM垃圾收集器&对象的引用回收

    1.介绍垃圾收集器 垃圾收集器(Garbage Collection,GC)就是用于回收方法区和堆区,其他程序计数器.虚拟机栈.本地方法栈这3个区域都是随线程而生,随线程而灭,栈中的栈帧会随着方法的进 ...

  7. 设计模式——状态模式(C++实现)

    /////////context.cpp #include "context.h" void STContext::ChangeState(STState* pstState) { ...

  8. html、css简述面试题

    hTML, HTTP,web综合问题 1.前端需要注意哪些SEO 合理的title.description.keywords:搜索对着三项的权重逐个减小,title值强调重点即可,重要关键词出现不要超 ...

  9. select子句和三种子查询

    一.select子句 五种子句 Where.group by.having.order by.limit Where.group by.having.order by.limit运用的这个顺序不能变 ...

  10. 用bat文件启动mongodb

    bat文件是dos下的批处理文件.批处理文件是无格式的文本文件,它包含一条或多条命令.它的文件扩展名为 .bat 或 .cmd.在命令提示下键入批处理文件的名称,或者双击该批处理文件,系统就会调用cm ...