MtK Posted September 10, 2004 Share Posted September 10, 2004 Hi,I'm using RunOnceEx to install my apps, & i'm using it with self-created variables (done with SetEnv & tested to work)I have a batch file that looks something like this:SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications" /fREG ADD %KEY%\000 /VE /D "Testing" /fREG ADD %KEY%\001 /V 1 /D "%%Install%%\app.exe" /fThe "%%" will make it look like "%" in the REGISTRY, so it executes:%Install%\App.exeduring login the RunOnceEx starts normally but I recieve an error saying the application cannot be found...as said before %Install% is set, & points correctly to the needed folder...what could it be? Link to comment Share on other sites More sharing options...
SiMoNsAyS Posted September 10, 2004 Share Posted September 10, 2004 i always thought system variables are expanded in the registry but...The "%%" will make it look like "%"... i'll suppose your registry entry looks like "%Install%\App.exe", the variable %install% it's defined during the runonceex importing process, but what about after reboot?i think i'm not explaining too well, after the reboot, when runonce process it's started, it finds a "%install%" entry but it isn't defined bcuz after the reboot, you haven't stablish it Link to comment Share on other sites More sharing options...
MtK Posted September 10, 2004 Author Share Posted September 10, 2004 I already tried, to run this after defining the variable & rebooting, but still... Link to comment Share on other sites More sharing options...
OcTroN Posted September 10, 2004 Share Posted September 10, 2004 That's quite strange. I'm creating a brand new preload right now and haven't tested it yet, but made it with variables in regfiles.When I import the reg file as seen below here it works fine, although not in the preinstallation, but just on a already installed windows system. Shouldn't make a difference though.@ECHO OFFSET SLEUTEL=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExSET SCRIPT=%systemdrive%\source\scriptSET PROGS=%systemdrive%\source\progsREG ADD %SLEUTEL% /V TITLE /D "Hello" /fREG ADD %SLEUTEL%\001 /VE /D "Bezig met voorbereiden..." /fREG ADD %SLEUTEL%\001 /V 1 /D "%SCRIPT%\start.cmd" /fREG ADD %SLEUTEL%\010 /VE /D "Adobe Reader 6.0.1" /fREG ADD %SLEUTEL%\010 /V 1 /D "%PROGS%\AdobeReader\AR601NL.msi /QB" /fWorks for me.Greetz Link to comment Share on other sites More sharing options...
OcTroN Posted September 10, 2004 Share Posted September 10, 2004 Ah wait a minute, didn't read correctly, you want that variable in the register. Sorry B) Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 10, 2004 Share Posted September 10, 2004 To what partition are you trying to point it toREG ADD %KEY%\001 /V 1 /D "%%Install%%\app.exe" /fHave you set the varible this wayset %Install%=%systemdrive%\Install\I am not sure but I think you have to define the varible in the batch to make it work. Link to comment Share on other sites More sharing options...
OcTroN Posted September 10, 2004 Share Posted September 10, 2004 as said before %Install% is set, & points correctly to the needed folder...Like SiMoNsAyS says (heh), the set= is gone when you reboot. If you don't re-set it then it will not fine the %Install% for sure. If you missed this thing you can make a .cmd at first RunOnceEx stage, although you can not point this to %Install%\re-set.cmd for example.Thats all what I can think about of at the moment. Good luck with finding a solution Link to comment Share on other sites More sharing options...
sleepnmojo Posted September 10, 2004 Share Posted September 10, 2004 In most registry keys, to get this to work you would make it a REG_EXPAND_SZ, but runonceex does not support the REG_EXPAND_SZ type variables. So they will get skipped if it sees the %INSTALL% variable.Unfortunately this is no way around this. You could always try adding cmd /c infront of every entry so that it re-routes through cmd thus giving you the variable. Not to sure how that would reacte though, so its YMMV. Link to comment Share on other sites More sharing options...
MtK Posted September 11, 2004 Author Share Posted September 11, 2004 Hi,if it was not understood, i'm talking about the first boot the machine does (RunOnceEx)the variables are set at first commands:REG ADD %KEY%\000 /V 1 /D "SetEnv /u Install C:\Install" /fbut the command that comes after that (during the same first-boot):REG ADD %KEY%\000 /V 2 /D "%%Install%%\app.exe" /fdoes not run, because it can't find %Install%\app.exe (which exists)(I checked after boot is done & the varable is still set OK...) Link to comment Share on other sites More sharing options...
sleepnmojo Posted September 11, 2004 Share Posted September 11, 2004 Hi,if it was not understood, i'm talking about the first boot the machine does (RunOnceEx)the variables are set at first commands:REG ADD %KEY%\000 /V 1 /D "SetEnv /u Install C:\Install" /fbut the command that comes after that (during the same first-boot):REG ADD %KEY%\000 /V 2 /D "%%Install%%\app.exe" /fdoes not run, because it can't find %Install%\app.exe (which exists)(I checked after boot is done & the varable is still set OK...)If you read my post again, then you can not use %INSTALL% in RunOnceEx. I'll re-explain here. The customary way to get system variables to work in the registry is by making them REG_EXPAND_SZ. So when it sees your variable %INSTALL%, it understands it is C:\install. THAT IS THE ONLY WAY. However, RunOnceEx does not support REG_EXPAND_SZ keys with variables in them. This is why this isn't working.The only way to get it to work is by routing it through cmd, by either using cmd /c, or a batch file. What you want to do does not exist.If my explaination is to much for you, tell me what you don't understand. Link to comment Share on other sites More sharing options...
MtK Posted September 11, 2004 Author Share Posted September 11, 2004 @sleepnmojo:you saying the command line:SetEnv /u Install C:\Installisn't good enough althought it is a dos command line?would it really make a difference if I first set the varible by cmd? Link to comment Share on other sites More sharing options...
sleepnmojo Posted September 11, 2004 Share Posted September 11, 2004 The way you make the variable looks fine. I don't use setenv, but I'm sure you have the syntax correct. Your problem is how you use it later, after setting it. Windows won't recognize it. It has to be done like everyone else does it, before you put it in the registry. Link to comment Share on other sites More sharing options...
MtK Posted September 16, 2004 Author Share Posted September 16, 2004 Although when the login is finished the variables exists? Link to comment Share on other sites More sharing options...
sleepnmojo Posted September 16, 2004 Share Posted September 16, 2004 The variables exist as soon as you log in.The following should workREG ADD %KEY%\000 /V 2 /D "cmd.exe /c %%Install%%\app.exe" /fThis wouldn't howeverREG ADD %KEY%\000 /V 2 /D "%%Install%%\app.exe" /fThis is because cmd.exe will interpret the variable, while runonceex won't.Note: I didn't test the cmd.exe way, but it should work in theory. Link to comment Share on other sites More sharing options...
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