您现在的位置是:网站首页> 编程资料编程资料
PowerShell ISE自动化简单示例_PowerShell_
2023-05-26
328人已围观
简介 PowerShell ISE自动化简单示例_PowerShell_
PowerShell ISE的自动化不依赖与任何第三方的框架和工具,因为PowerShell ISE本身就是可编程的。非常高大上地被称作为PowerShell抽象语法树,其实在之前的一篇文章中有简单分享过。关键点在于$PSISE变量。
今天再来看两行更加单的例子:
我想输出PowerShell ISE 中当前编辑框中的所有脚本:
复制代码 代码如下:
$psise.CurrentFile.Editor.Text
我想将PowerShell ISE中当前编辑框中的所有脚本中的某个字符串,替换成我期望的字符串,但是不使用PowerShell ISE中本身界面的查找和替换。
复制代码 代码如下:
$psise.CurrentFile.Editor.Text = $psise .CurrentFile.Editor.Text -replace '官本位' , '民本位'
相关内容
- Powershell ISE的抽象语法树编程示例_PowerShell_
- 揭秘PowerShell 5.0新特性和新功能_PowerShell_
- 简单谈谈PowerShell 4.0中的新命令_PowerShell_
- PowerShell 3.0管理Hyper-V 3.0_PowerShell_
- Windows 8 中的 PowerShell 3.0_PowerShell_
- PowerShell管理Win Server 2008 R2_PowerShell_
- 浅谈PowerShell 捕获错误_PowerShell_
- PowerShell打开或关闭光驱_PowerShell_
- PowerShell中的加法运算详解_PowerShell_
- PowerShell时间记录脚本_PowerShell_
