'FINDSTR'不被识别为内部或外部命令,可运行程序或批处理文件. rem @echo off SET /P path=Enter name of IEF folder: echo. && echo. SET /P file_name=Enter name of file: echo. && echo. cd C:\Program Files\CA\AllFusion Gen\GEN\%path%\c FINDSTR /C:"'V1600 OPER'" /C:"'V1714 OPER'" /C:"'R18 V1801 OPER'" /C:"'V1901 OPER'" "%file_name%"我还在环境变量的PATH变量中输入了值"C:\ WINDOWS \ system32".我对批处理脚本非常陌生.请帮忙.预先感谢.关于,莫希特·古普塔(Mohit Gupta).解决方案请勿将path用作您自己的变量之一,Windows会使用该特定环境变量来查找可执行文件,例如findstr您刚刚发现了.将其更改为类似mypath之类的内容,您的问题应会消失.I have a batch file with a portion shown below: rem @echo off cd C:\Program Files\CA\AllFusion Gen\GEN\test8.ief\c\ FINDSTR /C:"'V1600 OPER'" /C:"'V1714 OPER'" /C:"'V1801 OPER'" /C:"'V1901 OPER'" "MPOAD10C"The above batch file runs successfully with the above code. However, when I modified the script so that the user can enter two variables, as shown below (%path%=test8.ief,%file_name%=MPOAD10C), it throws the following error:'FINDSTR' is not recognized as an internal or external command,operable program or batch file. rem @echo off SET /P path=Enter name of IEF folder: echo. && echo. SET /P file_name=Enter name of file: echo. && echo. cd C:\Program Files\CA\AllFusion Gen\GEN\%path%\c FINDSTR /C:"'V1600 OPER'" /C:"'V1714 OPER'" /C:"'R18 V1801 OPER'" /C:"'V1901 OPER'" "%file_name%"I have also entered the value "C:\WINDOWS\system32" in the PATH variable in the Environment Variables.I am very new to batch scripting. Please help. Thanks in advance.Regards,Mohit Gupta. 解决方案 Don't use path as one of your own variables, that particular environment variable is used by Windows to locate executable files, such as findstr as you've just discovered.Change it to something like mypath and your problem should disappear. 这篇关于Findstr无法与SET/P一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-07 20:58