1

I wanted to automate the process of creating xpi using winrar with pwd being used instead of passing the current dir from outisde.

@REM ------- BEGIN xpi.bat ----------------
@setlocal
@echo off
set path="C:\Program Files\WinRAR\";%path%

winrar.exe a -afzip -r -ep1 %PWD%/MYaddon.xpi %PWD%

REM ------- END xpi.bat ------------------

Edit : So here is the final batch:

@REM ------- BEGIN xpi.bat ----------------
@setlocal
@echo off
set path="C:\Program Files\WinRAR\";%path%
erase "%CD%\MyAddon.xpi"
winrar.exe a -afzip -r -ep1 "%CD%\MyAddon.xpi" "%CD%/*"

REM ------- END xpi.bat ------------------
adnan kamili
  • 8,967
  • 7
  • 65
  • 125
  • tweak: you may beed to exclude xpi.bat from the final .xpi file so here is a tip change last line to winrar.exe a -afzip **-xxpi.bat** -r -ep1 "%CD%\MyAddon.xpi" "%CD%/*" – EzzDev Dec 21 '15 at 02:41

1 Answers1

1

Use "%CD%\MYaddon.xpi".

  • In windows, to retrieve the current directory, the %CD% variable is used.

  • Windows can handle slashes as directory separator, but not all programs running in windows do, so, it is better to use backslashes.

MC ND
  • 69,615
  • 8
  • 84
  • 126
  • 1
    The resulting xpi is corrupt – adnan kamili Mar 07 '14 at 07:41
  • @adnankamili, If you have your batch in the same folder, exclude it. Change your code as `winrar.exe a -afzip -m5 -ed -pTest -r -ep1 -x"%~nx0" "%CD%\MyAddon.xpi" "%CD%\*"` Anyway, it should be better to have the files required for your addon in a separate folder and then use `winrar.exe a -afzip -m5 -ed -pTest -r -ep1 "%CD%\MyAddon.xpi" "%CD%\addonFolder\*"` – MC ND Mar 07 '14 at 07:47
  • @adnankamili, i have now readed your parameter list. I think you can not password protect a .xpi file (see [here](http://support.mozilla.org/en-US/questions/959622) ) – MC ND Mar 07 '14 at 07:55