powershell switch和参数
2015-05-04 11:33
337 查看
function funarg()
{
switch($args)
{
"all" { Get-WmiObject -Class win32_logicaldisk}
"c" { (Get-WmiObject -Class win32_logicaldisk)[1]}
"free" { Get-WmiObject -Class win32_logicaldisk[1].freespace}
"help" { $help = @"
This script will print out the c drive information for all divers,only the c
drive,or the free space on c: it also will print out a help topic Example:
>GetDriverargs.ps1 all
print out information on all drices
>GetDriverargs.ps1 c
print out information on only the c drive
>GetDriverargs.ps1 free
print out freespace on the c drive
"@
write-host $help}
}
}
#$args="help"
funarg($args)
{
switch($args)
{
"all" { Get-WmiObject -Class win32_logicaldisk}
"c" { (Get-WmiObject -Class win32_logicaldisk)[1]}
"free" { Get-WmiObject -Class win32_logicaldisk[1].freespace}
"help" { $help = @"
This script will print out the c drive information for all divers,only the c
drive,or the free space on c: it also will print out a help topic Example:
>GetDriverargs.ps1 all
print out information on all drices
>GetDriverargs.ps1 c
print out information on only the c drive
>GetDriverargs.ps1 free
print out freespace on the c drive
"@
write-host $help}
}
}
#$args="help"
funarg($args)
相关文章推荐
- jstl 获取Parameter参数 , switch使用
- 使用switch制作Powershell命令菜单
- switch的参数
- java中switch能否使用String作为参数?
- 在jdk 1.6版本中,switch的参数无法使用String类型
- 我用的是jdk1.7,但switch传string的参数报错
- PowerShell定义函数参数的2种方法和传参方法实例
- Windows Powershell Switch 循环
- PowerShell函数参数使用智能提示功能例子
- 6.PowerShell -- 对象,格式和参数
- JAVA中switch是否支持String类型参数?
- Java学习笔记——switch语句的参数类型
- switch_to宏为什么要三个参数
- PowerShell命令测试--whatif参数
- PowerShell- Windows Powershell中的函数参数
- iOS switch的参数怎么使用NSString?
- Switch能否使用String做参数
- switch的参数类型
- switch的参数
- android switch不能使用参数String,View等类的解决方法