switch后面的-file参数是用来做什么的?


PowerShell交流中心分类: 变量-函数-脚本-条件-循环-参数switch后面的-file参数是用来做什么的?
0
GanZiQim asked 7年 ago

今天用ise写switch时发现switch关键字后面可以加上-file,请问这个参数是用来做什么的?

GanZiQim replied 7年 ago

自问自答,刚刚查了一下资料,-file关键字用于从文件里面导入参数输入到switch中,具体的结构如下:

switch [-regex|-wildcard|-exact] -casesensitive] -file filename
{
“string”|number|variable|{expression} { statement }
default { statement }
}