chikky Posted January 3, 2007 Posted January 3, 2007 I want to import a registry file with "universal syntax" to add a context menu entry during install. I am extracting my application to temp folder and running from there. To add the context menu item, I have to import the following registry value[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Add to My App\command]@="\"C:\\Documents and Settings\\username\\Local Settings\\Temp\\Myapp.exe\" %L"Here, I don't want to use absolute path so that it is not dependent on the user or the machine. I want to use it with some universal syntax like[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Add to My App\command]@="\"%Temp%\\Myapp.exe\" %L"I have tried it with no success. It adds the value "add to my app" in the context menu but cannot find the path. Is there any way to do this?I am sure that I can find some solution through this forum.
Sonic Posted January 3, 2007 Posted January 3, 2007 You must use registry editor in command line with "reg add" command in a batch file which is support variables.
chikky Posted January 4, 2007 Author Posted January 4, 2007 (edited) You must use registry editor in command line with "reg add" command in a batch file which is support variables.Thanks for replying, Sonic. But can you elaborate little more? For example, what should I write in batch file for my case? Edited January 4, 2007 by chikky
ajua Posted January 4, 2007 Posted January 4, 2007 sonic reffered to a DOS command wich supoports variables when importing entries into registry.example: in your cmd or bat file you add thisREG ADD HKLM\SOFTWARE\Classes\Folder\shell\Add to My App\command\ /D "%userprofile%\Local Settings\Temp\Myapp.exe"this will add the dword (/D) value %userprofile%\Local Settings\Temp\Myapp.exe into HKLM\SOFTWARE\Classes\Folder\shell\Add to My App\commandi dont remeber the syntax for the other type of values that windows registry accepts, try /help on reg.exe
Yzöwl Posted January 4, 2007 Posted January 4, 2007 REG ADD "HKLM\SOFTWARE\Classes\Folder\shell\Add to My App\command" /VE /T REG_EXPAND_SZ /D "\"%%Temp%%\Myapp.exe\" %%L" >NUL<Edit>This is just a correction to the above post.</Edit>
chikky Posted January 9, 2007 Author Posted January 9, 2007 REG ADD "HKLM\SOFTWARE\Classes\Folder\shell\Add to My App\command" /VE /T REG_EXPAND_SZ /D "\"%%Temp%%\Myapp.exe\" %%L" >NUL<Edit>This is just a correction to the above post.</Edit>REG ADD "HKLM\SOFTWARE\Classes\Folder\shell\Add to My App\command" /VE /T REG_EXPAND_SZ /D "\"%Temp%\Myapp.exe\" %%L" This is working on winxp but not on win2k.
Sonic Posted January 23, 2007 Posted January 23, 2007 You can make a batch to create a temporal .reg.Example :@echo off>FixReg.reg echo REGEDIT4>>FixReg.reg echo.>>FixReg.reg echo [...\SOFTWARE\Classes\Folder\shell\Add to My App]>>FixReg.reg echo "command"="%Temp%\Myapp.exe"start /w regedit /s FixReg.regdel FixReg.regexitThis will create reg file with correct fixed value, not variable.
chikky Posted January 30, 2007 Author Posted January 30, 2007 You can make a batch to create a temporal .reg.Example :@echo off>FixReg.reg echo REGEDIT4>>FixReg.reg echo.>>FixReg.reg echo [...\SOFTWARE\Classes\Folder\shell\Add to My App]>>FixReg.reg echo "command"="%Temp%\Myapp.exe"start /w regedit /s FixReg.regdel FixReg.regexitThis will create reg file with correct fixed value, not variable.No, it doesn't work. It adds the key "Add to My App" to the registry but not the value. Any help on this?
Sonic Posted February 3, 2007 Posted February 3, 2007 Just re-tested I obtain this regfile REGEDIT4[...\SOFTWARE\Classes\Folder\shell\Add to My App]"command"="C:\DOCUME~1\Sonic\LOCALS~1\Temp\Myapp.exe"Sure you must adapt the script to your goal.
FenyX Posted October 11, 2007 Posted October 11, 2007 I know this topic is old but as your solution can't work, I have to add some precisions, Sonic.Your final result should look like that:REGEDIT4[...\SOFTWARE\Classes\Folder\shell\Add to My App]"command"="C:\\DOCUME~1\\Sonic\\LOCALS~1\\Temp\\Myapp.exe"And I really don't know how to replace "\" with "\\" only for the value and data (and not for the key path) through the way you have explained here (nor through another one ).
Sonic Posted October 11, 2007 Posted October 11, 2007 oops ! indeed, I have completely forgotten the "\\" thing in .reg file ... so you must use reg.exe which support one "\" ... and you will lose compatability with win2k except you copy reg.exe to each win2k station : you can make a small sfx to install reg.exe and run this sfx from the batch.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now