谢谢各位,看来,如果要用findstr ,还是无解。我只是想为何powershell_ise正常,但powershell始终不正常,是不是系统或powershell的某个参数设置不正确,因此搜了百度,但也找不到正确答案。附一个自己最近探索到的对powershell的输入问题的解决方案。懂的自然懂。- if ($true){}# == ($true){}# goto ___yiwuyun
- <#BeginBatOperation#
- :___yiwuyun
- @echo off&setlocal&cls
- (echo $yiwuyun_fileName="%~f0"&echo $strPath="%~dp0"&type "%~f0")|powershell -command -
- pause
- exit/b 0
- #EndBatOperation#>
-
- <#StartPowerShell#>
-
- write-host "test read data from control";
- $bat=@"
- @echo off&setlocal&cls
- set /P ip=`"input ip addres:`"
- set /P mask=`"input mask:`"
- set /P gw=`"input gateway:`"
- >test.bat echo %ip% %mask% %gw%&exit
- "@
- $bat| Out-File -Encoding oem -FilePath test.bat
-
- $cmd=cmd /C "start test.bat"
- $content=$(gc test.bat);
- if($(Test-Path -Path test.bat)){remove-item -path test.bat}
- write-host "your input text is : $content";
-
- <#EndPowerShell#>
复制代码
|