Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#1
Post
by Dos_Probie » 28 Sep 2012 18:28
When running this batch with my .xmi files I get the following error
"Could not find process: firefox"
and then "The system cannot find the file specified."
It unzips the .xmi files to the temp folder then errors out and deletes them..
If anyone can proof this and make any corrections I would greatly appreciate it..
Code: Select all
@echo off
Title ==Firefox Multi-Addon Installer==
echo.
Echo Installing youraddon..
IF EXIST "%temp%\youraddon\" rd /s /q "%temp%\youraddon"
MD "%temp%\youraddon\addon"
Start /B /Wait "Extracting" "UnZip.exe" -q -o "*.xpi" -d "%temp%\youraddon\addon"
FOR /F "tokens=2,3 delims=^<^>=" %%i in ('FIND "em:id" "%temp%\youraddon\addon\install.rdf"') DO (IF "%%~j"=="" (SET xpi_id=%%~i&GOTO :vaivai) ELSE (SET xpi_id=%%~j&GOTO :vaivai))
:vaivai
IF NOT DEFINED xpi_id (
ECHO.
ECHO.
Echo Error occured while extracting..
ping.exe 127.0.0.1 -n 4 >NUL
EXIT
)
:: kill firefox or get write error
tskill firefox.exe
FOR /F %%a in ('dir /ad /b "%appdata%\Mozilla\Firefox\Profiles\*.default"') DO (
IF EXIST "%appdata%\Mozilla\Firefox\Profiles\%%a\extensions\%xpi_id%\" rd /s /q "%appdata%\Mozilla\Firefox\Profiles\%%a\extensions\%xpi_id%"
IF NOT EXIST "%appdata%\Mozilla\Firefox\Profiles\%%a\extensions\%xpi_id%\" MD "%appdata%\Mozilla\Firefox\Profiles\%%a\extensions\%xpi_id%"
FOR /F "tokens=*" %%i in ('dir /b /og "%temp%\youraddon\%xpi_id%\"') DO Move /y "%temp%\youraddon\%xpi_id%\%%i" "%appdata%\Mozilla\Firefox\Profiles\%%a\extensions\%xpi_id%\"
)
echo.
echo Installation Done!
ping.exe 127.0.0.1 -n 4 >NUL
IF EXIST "%temp%\youraddon\" rd /s /q "%temp%\youraddon"
exit
Last edited by
Dos_Probie on 01 Oct 2012 13:35, edited 1 time in total.
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#2
Post
by abc0502 » 28 Sep 2012 19:04
I think the problem in the first for loop that set the xpi_id variable.
replace the set command in the if else statement in a way it echo the i and j vars, and remove the goto command and add pause after the for loop, and compare the out put with the one that should appear.
all the errors that happen, happen in the section of the vaivai label, which depend on that for loop
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#3
Post
by Dos_Probie » 28 Sep 2012 19:08
Thanks, for the comment..
If I run the second for statement it says moved file and moves over to extensions folder in my profile..
If you have an example I can work on that and see what happens..

-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#4
Post
by abc0502 » 28 Sep 2012 19:11
i'm taking about the first one this one:
Code: Select all
FOR /F "tokens=2,3 delims=^<^>=" %%i in ('FIND "em:id" "%temp%\youraddon\addon\install.rdf"') DO (IF "%%~j"=="" (SET xpi_id=%%~i&GOTO :vaivai) ELSE (SET xpi_id=%%~j&GOTO :vaivai))
dose the xpi_id variable have the right data that it supposed to hold
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#5
Post
by abc0502 » 28 Sep 2012 19:22
"Could not find process: firefox"
The command
casue it, if the process is not exist it will generate that error.
so check to see if the process exist or not before running the command or just redirect the error
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#6
Post
by Dos_Probie » 28 Sep 2012 20:05
"The system cannot find the file specified." error comes AFTER the tskill even if I rem it out..
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#7
Post
by abc0502 » 28 Sep 2012 20:22
The only files that could be missing is in the last for loop, the one that make the move,
remove this for loop and only use the move command like this, there is no need for it any way.
intead of this
Code: Select all
FOR /F "tokens=*" %%i in ('dir /b /og "%temp%\youraddon\%xpi_id%\"') DO Move /y "%temp%\youraddon\%xpi_id%\%%i" "%appdata%\Mozilla\Firefox\Profiles\%%a\extensions\%xpi_id%\"
use this
Code: Select all
Move /y "%temp%\youraddon\%xpi_id%\*.*" "%appdata%\Mozilla\Firefox\Profiles\%%a\extensions\%xpi_id%\"
what is the content of the variable"%xpi_id%"?
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#11
Post
by abc0502 » 29 Sep 2012 05:01
"The system cannot find the file specified."
I made a test on move command,
if you try to
move files
from an Existing folder
to non Existing folder,
no errors whether there is files to move or not.
But when you try to
move files
from non Existing folder
to an Existing or
non Existing folder
it give the same error messageis the folder that you are trying to move data from exist ??
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#12
Post
by Dos_Probie » 29 Sep 2012 05:38
Ok it Does exists in my temp folder and will move it over to my profile extensions folder but then I still
get "The system cannot find the path specified" , also would there be a way to just specify each addon in the
script with just its own uniquie xpi id and run it that way?..
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#13
Post
by abc0502 » 29 Sep 2012 05:52
how many profiles do you have in the firefox?
and can you post a link to this xpi files so i can test it in my pc?
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#14
Post
by Dos_Probie » 29 Sep 2012 06:27
I only have ONE Profile so that should simplify it.. and then about six addons .. would this script work if i just customize it for
each addon
Code: Select all
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F "tokens=2,3 delims=^<^>=" %%i in ('FIND "em:id" "install.rdf"') DO (
IF "%%~j"=="" (
SET xml_id=%%~i
) ELSE (
SET xml_id=%%~j
)
IF /I "!xml_id!" NEQ "" (
:: don't match tbird's id
IF /I "!xml_id!" NEQ "{3550f703-e582-4d05-9a08-453d09bdfdc6}" (
:: don't match seamonkey's id
IF /I "!xml_id!" NEQ "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}" (
:: don't match firefox's id
IF /I "!xml_id!" NEQ "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" (
:: don't match sunbird's id
IF /I "!xml_id!" NEQ "{718e30fb-e89b-41dd-9da7-e25a45638b28}" (
GOTO :vaivai
)
)
)
)
)
)