Halfwalker Posted January 23, 2006 Share Posted January 23, 2006 Dang it - magic incantation needed here, and I'm missing it.As part of the pdfFactory install, I want to remove the default Start Menu folder, and to load the following into the Default User hive ... This is done in the RunOnceEx.cmd batchfileREG LOAD "HKU\CUSTOM" "C:\Documents and Settings\Default User\NTUSER.DAT"REG ADD HKU\CUSTOM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v pdfFactory /t REG_EXPAND_SZ /d "cmd.exe /C rd /q /s \"%userprofile%\Start Menu\Programs\pdfFactory Pro\"" /fREG UNLOAD "HKU\CUSTOM"Note the %userprofile% there. That's what I want in the key, so when a new user is created, the new userid is replaced in there.But bloody batchfile insists on putting in the current user when this command is run, so the effective command looks like :REG ADD HKU\CUSTOM\Software\Microsoft\Windows\CurrentVersion\RunOnce /v pdfFactory /t REG_EXPAND_SZ /d "cmd.exe /C rd /q /s \"c:\Documents and Settings\Administrator\Start Menu\Programs\pdfFactory Pro\"" /fWhich is NOT what I want.How do I "protect" the %userprofile% string in there from replacement in the batchfile ?D. Link to comment Share on other sites More sharing options...
jcarle Posted January 23, 2006 Share Posted January 23, 2006 First of all, you have a leading \... that'll mess up your path...ie:rd /q /s \"%userprofile%\Start Menu\Programs\pdfFactory Pro\"" /fshould berd /q /s "%userprofile%\Start Menu\Programs\pdfFactory Pro\"" /fUnless there's a specific reason for it.And to insert %userprofile% in your batch file... write %%userprofile%%.ie:rd /q /s "%%userprofile%%\Start Menu\Programs\pdfFactory Pro\"" /f Link to comment Share on other sites More sharing options...
Halfwalker Posted January 28, 2006 Author Share Posted January 28, 2006 jcarle -Thanks - the %%userprofile%% is what I was looking for !There isn't a leading \ in there - that's escaping the double-quotes, to make sure that they are in the key."cmd.exe /C rd /q /s \"%userprofile%\Start Menu\Programs\pdfFactory Pro\""D. 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