Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在powershell中提示输入_Powershell_Batch File_Cmd_Powershell 2.0 - Fatal编程技术网

在powershell中提示输入

在powershell中提示输入,powershell,batch-file,cmd,powershell-2.0,Powershell,Batch File,Cmd,Powershell 2.0,我想修改脚本,以提示在选择字符串中输入字符串模式。我该怎么做 $FileExists = (Test-Path C:\Users\v-hshabb\Desktop\text.txt) echo $FileExists If (($FileExists)) { echo $FileExists Remove-Item C:\Users\v-hshabb\Desktop\text.txt } GET-CHILDITEM -recurse C:\Enlistment\DAX62\source

我想修改脚本,以提示在选择字符串中输入字符串模式。我该怎么做

$FileExists = (Test-Path C:\Users\v-hshabb\Desktop\text.txt)
echo $FileExists
If (($FileExists)) 
{
echo $FileExists
  Remove-Item C:\Users\v-hshabb\Desktop\text.txt
}

GET-CHILDITEM  -recurse C:\Enlistment\DAX62\source\*| SELECT-STRING -pattern "@GLS150005"    >text.txt

在调用Get ChildItem之前使用Read Host

$pattern = Read-Host
gci -recurse C:\Enlistment\DAX62\source\*| SELECT-STRING -pattern $pattern >text.txt