midiboy Posted February 9, 2005 Posted February 9, 2005 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 %%jSo, I tried this in my runonceex:REG ADD %KEY%\007 /VE /D "Windows XP PostSP2 Updates" /fREG ADD %KEY%\007 /V 1 /D "CMD /C for %%i in (%CDROM%\Setup\Updates\*.exe) do start /wait %%i /passive /norestart /quiet" /fREG ADD %KEY%\009 /VE /D "Mozilla Firefox Extensions" /fREG 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" /fThis 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 /norestartI 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
Dahi Posted February 9, 2005 Posted February 9, 2005 Try thisSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExSET TXT="CMD /C for %%i in (%CDROM%\Setup\Updates\*.exe) do start /wait %%i /passive /norestart /quiet"REG ADD %KEY%\007 /VE /D "Hotfixes" /fREG ADD %KEY%\007 /V 1 /D %TXT% /fSET TXT=CMD /C for %%i in (%CDROM%\SETUP\Firefox\xpi\*.xpi) do start /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" -install-global-extension %%iREG ADD %KEY%\009 /VE /D "Mozilla Firefox Extensions" /fREG ADD %KEY%\009 /V 1 /D "%TXT%" /f
midiboy Posted February 9, 2005 Author Posted February 9, 2005 Hi Dahi,thanks ! But unfortunately, I still get the message "Too many command line parameters" .... Bye,Alex
Dahi Posted February 9, 2005 Posted February 9, 2005 It works for me. Try copying my code into a TEST.CMD fileAdd a SET CDROM=C: at the top of the fileThen run it from a command prompt to see which line is causing errors
gunsmokingman Posted February 9, 2005 Posted February 9, 2005 I Dont Know If This Will Work But Give It A Tryfor %%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=%%iif exist %CDROM%\SETUP\Firefox\xpi\*.xpi goto S1:S1Set A1=start /wait "%CDROM%\SETUP\Firefox\xpi\*.* /passive /norestart /quiet"REG ADD %KEY%\007 /VE /D "FireFox" /fREG ADD %KEY%\007 /V 1 /D %A1% /fIf exist start /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" goto S2:S2set A2 = start /wait \"%PROGRAMFILES%\Mozilla Firefox\firefox.exe\" -install-global-extension %%j" REG ADD %KEY%\009 /VE /D "Mozilla Firefox Extensions" /fREG ADD %KEY%\009 /V 1 /D "%A2% /f
asbsamsf Posted February 9, 2005 Posted February 9, 2005 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)
midiboy Posted February 9, 2005 Author Posted February 9, 2005 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" /fBut the same command using the "for" command causes the error message.Thanks for your help,Alex
Dahi Posted February 9, 2005 Posted February 9, 2005 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
midiboy Posted February 10, 2005 Author Posted February 10, 2005 Dahi,you know what ? YOU ARE A GENIUS ! Thanks a lot, it works perfectly ! Bye,Alex
midiboy Posted February 10, 2005 Author Posted February 10, 2005 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" /fREG 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" /fREG 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now