Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.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
Batch file 修改所有Mozilla FireFox配置文件的批处理文件_Batch File_Firefox - Fatal编程技术网

Batch file 修改所有Mozilla FireFox配置文件的批处理文件

Batch file 修改所有Mozilla FireFox配置文件的批处理文件,batch-file,firefox,Batch File,Firefox,我想用一个批处理文件修改所有FireFox配置文件,但我无法让它工作,它将只修改默认配置文件 @Echo off taskkill /im firefox.exe* /f if exist "%APPDATA%\Mozilla\Firefox\Profiles\*." (GOTO TRT) ELSE (GOTO END) :TRT cd "%APPDATA%\Mozilla\Firefox\Profiles\*." echo user_pref("network.automatic-ntlm-

我想用一个批处理文件修改所有FireFox配置文件,但我无法让它工作,它将只修改默认配置文件

@Echo off
taskkill /im firefox.exe* /f
if exist "%APPDATA%\Mozilla\Firefox\Profiles\*." (GOTO TRT) ELSE (GOTO END)
:TRT
cd  "%APPDATA%\Mozilla\Firefox\Profiles\*."
echo user_pref("network.automatic-ntlm-auth.trusted-uris", ".tests"); >>prefs.js
:END

你不能像你想做的那样简单

您必须在目录上循环,并以这种方式重复步骤:

@echo off
taskkill /f /IM firefox.exe
if exist "%APPDATA%\Mozilla\Firefox\Profiles\" Goto :trt
Goto :eof
:trt
cd "%APPDATA%\Mozilla\Firefox\Profiles\"
for /d %%a in (*) do (
pushd %%a
if exist "prefs.js" (
echo( >> prefs.js
echo user_pref("network.automatic-ntlm-auth.trusted-uris", ".tests"); >> prefs.js
)
popd
)
虽然没有测试

说明:

如前所述,关闭所有
firefox.exe的实例

如果配置文件文件夹存在,请继续<代码>:eof
是一个不可见的标签,标记
e
nd
o
f
f
ile。
将当前目录更改为配置文件文件夹。
对于(*)中的每个
/d
目录
(=all)
do

  • 将单个概要文件文件夹的路径推送到堆栈上并更改为该路径
  • 检查文件
    prefs.js
    是否存在,如果存在,则回显一个安全新行和您的值
  • 弹出
    堆栈中的路径并返回到配置文件文件夹

另外:请看stackoverflow的例子:)

我这方面确实犯了一个错误。我没有直截了当地思考,正如所说的,它还没有经过测试。我更新了代码和解释,并立即进行了测试。