Jump to content

Recommended Posts

Posted

Hi guys,

I have been playing around with this and I have been looking for a solution but cannot find it ... :(

I would like to use the "for" command in runonceex. But it won´t work. I cannot even get the command to transer properly to the registry ...

Here are two commands from batch files I would like to use in the runonceex instead:

1.

1.
for %%i in (%CDROM%\Setup\Updates\*.exe) do start /wait %%i /passive /norestart /quiet"
2.
for %%j in (%CDROM%\SETUP\Firefox\xpi\*.xpi) do start /wait "%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -install-global-extension %%j

So, I tried this in my runonceex:

REG ADD %KEY%\007 /VE /D "Windows XP PostSP2 Updates" /f
REG ADD %KEY%\007 /V 1 /D "CMD /C for %%i in (%CDROM%\Setup\Updates\*.exe) do start /wait %%i /passive /norestart /quiet" /f

REG ADD %KEY%\009 /VE /D "Mozilla Firefox Extensions" /f
REG ADD %KEY%\009 /V 1 /D "CMD /C for %%j in (%CDROM%\SETUP\Firefox\xpi\*.xpi) do start /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" -install-global-extension %%j" /f

This gives me the error message: too many arguments (translated from German)

So I tried with %i instead of %%i. This does not give an error message, however, the command for the Windows Updates in they registry key now looks like this:

CMD /C for CDROMi /passive /norestart

I then tried all sorts of things like add a "\" before each bracket etc. but nothing seems to work ....

Mhh ... could need some help here if you have any ideas ...

Thanks,

Alex


Posted

Try this

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

SET TXT="CMD /C for %%i in (%CDROM%\Setup\Updates\*.exe) do start /wait %%i /passive /norestart /quiet"

REG ADD %KEY%\007 /VE  /D "Hotfixes" /f
REG ADD %KEY%\007 /V 1 /D %TXT% /f

SET TXT=CMD /C for %%i in (%CDROM%\SETUP\Firefox\xpi\*.xpi) do start /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" -install-global-extension %%i

REG ADD %KEY%\009 /VE /D "Mozilla Firefox Extensions" /f
REG ADD %KEY%\009 /V 1 /D "%TXT%" /f

Posted

It works for me. Try copying my code into a TEST.CMD file

Add a SET CDROM=C: at the top of the file

Then run it from a command prompt to see which line is causing errors

Posted

I Dont Know If This Will Work But Give It A Try

for %%i in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do if exist %%i\SETUP.exe set CDROM=%%i

if exist %CDROM%\SETUP\Firefox\xpi\*.xpi goto S1
:S1
Set A1=start /wait "%CDROM%\SETUP\Firefox\xpi\*.* /passive /norestart /quiet"

REG ADD %KEY%\007 /VE  /D "FireFox" /f
REG ADD %KEY%\007 /V 1 /D %A1% /f

If exist start /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\"  goto S2
:S2
set A2 = start /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" -install-global-extension %%j"
REG ADD %KEY%\009 /VE /D "Mozilla Firefox Extensions" /f
REG ADD %KEY%\009 /V 1 /D "%A2% /f

Posted

Try 1.

for /R %CDROM%\Setup\Updates %%i in (*.exe ) do (
    start/wait "%CDROM%\Setup\Updates\%%~ni.exe /passive /norestart /quiet"
)

2.

for /R %CDROM%\SETUP\Firefox\xpi %%j in (*.xpi ) do (
    start/wait "%PROGRAMFILES%\Mozilla Firefox\firefox.exe" -install-global-extension %CDROM%\SETUP\Firefox\xpi\%%~ni.xpi
)

Posted

Hi guys !

THANKS ! Both asbsamsf´s and Dahi´s version work fine now. The problem was that I had my test files on the Desktop and SET CDROM was containing the path to it. Seemingly there are no spaces allowed in there so thats where the error was.

HOWEVER, I now have a problem with the execution of the commands. The Hotfixes install fine, but the Firefox extension installation has a problem. As you can see on the picture (although in german) Windows wants to find a file named "-install-global-extension if this command is run ...

Of course it cannot find it and causes an error message to appear.

I have no idea how to correct this, the installation works fine if I use this command (without any "for"):

REG ADD %KEY%\009 /V 1 /D "\"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" -install-global-extension %CDROM%\SETUP\Firefox\xpi\disable_targets_for_downloads-0.8-fx.xpi" /f

But the same command using the "for" command causes the error message.

Thanks for your help,

Alex

Posted

Try adding quote marks between the START and the /WAIT. START often gets confused if you leave out the "title" parameter.

SET TXT=CMD /C for %%i in (%CDROM%\SETUP\Firefox\xpi\*.xpi) do start \"\" /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" -install-global-extension %%i

Posted

Hi again,

as it turns out, I had a small cosmetic problem during installation now because a cmd window would now open during the installation of the hotfixes and display (echo) the installation of every hotfix and firefox extension. CMD /C was not enough if "for" was used.

But I managed to solve that one on my own :) I just added this:

@echo off & cmdow @ /HID &  

to the command, before start /wait and it works now without any cmd window opening. So the final commands are like this:

REG ADD %KEY%\007 /VE /D "Windows XP PostSP2 Updates" /f
REG ADD %KEY%\001 /V 2 /D "CMD /C for %%i in (%CDROM%\Setup\Updates\*.exe) do @echo off & cmdow @ /HID & start /wait %%i /passive /norestart /quiet" /f


REG ADD %KEY%\008 /VE /D "Mozilla Firefox 1.0 inkl. Extensions" /f
....
REG ADD %KEY%\008 /V 6 /D "CMD /C for /R %CDROM%\SETUP\Firefox\xpi %%i in (*.xpi) do @echo off & cmdow @ /HID & start \"\" /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" -install-global-extension %CDROM%\SETUP\Firefox\xpi\%%~ni.xpi" /f

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...