![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
windows
文章平均质量分 67
besfanfei
这个作者很懒,什么都没留下…
展开
-
windows powershell
1,Set-ExecutionPolicy RemoteSigned设置执行ps1脚本的权限2,脚本的参数保存在数组$args中$args[0] 第一个参数$args.Count 数组的长度参考(百度:Powershell 给脚本传递参数)3,脚本之间传递全局变量,类似于linux shell中的exportsett-variable -name 变量名 -原创 2012-12-15 10:49:08 · 396 阅读 · 0 评论 -
powershell 设置IP地址
# 获取网络适配器$wmi=get-wmiobject -class win32_networkadapterconfiguration -filter ipenabled=true -computername .# 设置IP地址和子网掩码$wmi.EnableStatic('192.168.0.100','255.255.255.0')# 设置网关$wmi.SetGatewa转载 2012-12-28 09:18:35 · 9283 阅读 · 0 评论 -
powershell的一个脚本,用来测试命令的
# $1: testcase script# xxx.test: testcase script# directory specified: run.ps1 for each *.test under directory# execute this script in windows powershell#: ${1:?Specify test-script-file}if (原创 2012-12-19 17:47:25 · 1023 阅读 · 0 评论 -
Windows PowerShell 2.0之脚本块变量作用域
变量作用域用来定义程序中哪些部分可以使用某个变量。PowerShell中对象的作用域规则设计得很巧妙,类似变量,但是却更强大,在脚本块、函数和脚本边界传递。本文仅给出脚本块中作用域的清晰定义,其他有关函数和脚本文件的作用域会分其他系列文章中详细介绍。变量作用域定义作用域是计算机科学中用于定义变量可以在哪些代码区域中起作用,类似于命名空间。这种机制允许用于在不同的环境下使用相同命名的转载 2012-12-19 15:22:05 · 740 阅读 · 0 评论 -
powershell
function setVars(){#验证配置文件是否存在,如果不存在则退出if ( -not (& test-path ${VAR_FILE})){echo " "echo "please make sure that config.txt file exists!"exit 1 }#读取配置文件$result=$(cat ${VAR_FILE})原创 2013-02-01 18:48:53 · 604 阅读 · 0 评论