【发布时间】:2018-12-06 17:18:10
【问题描述】:
我在 Windows 上,正在尝试使用以下批处理文件:
@echo off &setlocal
set "search=false); // disable U"
set "replace=true); // disable U"
set "textfile=C:\Program Files (x86)\Mozilla Firefox\mozilla.cfg"
call jrepl.bat "%search%" "%replace%" /f "%textfile%" /o -
pause
更改配置文件中的一行。当我运行文件时,它说
'jrepl.bat' is not recognized as an internal or external command.
我的批处理文件和 jrepl.bat 都保存到桌面。如何让我的批次找到 jrepl?
【问题讨论】:
-
您没有以管理员身份运行批处理脚本,是吗?如果 jrepl.bat 与您所说的脚本位于同一目录中,那么这是您发布的代码无法正常工作的唯一可能原因。
-
要么确保
jrepl.bat所在的目录在PATH变量中,要么在命令中指定jrepl.bat的完整路径。CALL "C:\path\to\jrepl\dir\jrepl.bat" -
我会写
call "%~dp0jrepl.bat"以确保找到它,因为它与您的批处理文件放在同一目录中,正如您所声称的那样...... -
@SomethingDark 我以管理员身份运行脚本。 @lit 我使用了完整路径并得到了这个错误
JScript runtime error in Search regular expression: Syntax error in regular expression -
)通常是正则表达式中的组字符,因此您可能需要使用反斜杠对其进行转义以使其成为文字,即set "search=false\); // disable U"
标签: batch-file cmd windows-10 jrepl