MSFN Forum: universal syntax in reg file - possible? - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

universal syntax in reg file - possible? Rate Topic: -----

#1 User is offline   chikky 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 02-September 06

Posted 03 January 2007 - 12:36 AM

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.


#2 User is offline   Sonic 

  • Sonic
  • Group: Patrons
  • Posts: 1,595
  • Joined: 04-December 03

Posted 03 January 2007 - 01:13 PM

You must use registry editor in command line with "reg add" command in a batch file which is support variables.

#3 User is offline   chikky 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 02-September 06

Posted 03 January 2007 - 09:58 PM

View PostSonic, on Jan 4 2007, 01:13 AM, said:

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?

This post has been edited by chikky: 03 January 2007 - 09:58 PM


#4 User is online   ajua 

  • Custom Installer Maker
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,260
  • Joined: 16-April 05

Posted 04 January 2007 - 01:26 AM

sonic reffered to a DOS command wich supoports variables when importing entries into registry.
example: in your cmd or bat file you add this

REG 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\command

i dont remeber the syntax for the other type of values that windows registry accepts, try /help on reg.exe

#5 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,114
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 04 January 2007 - 06:12 AM

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>

#6 User is offline   chikky 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 02-September 06

Posted 06 January 2007 - 01:37 AM

Thank you all. I will try this.

#7 User is offline   chikky 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 02-September 06

Posted 09 January 2007 - 03:01 AM

View PostYzöwl, on Jan 4 2007, 06:12 PM, said:

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.

#8 User is offline   Sonic 

  • Sonic
  • Group: Patrons
  • Posts: 1,595
  • Joined: 04-December 03

Posted 23 January 2007 - 04:36 PM

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.reg
del FixReg.reg
exit


This will create reg file with correct fixed value, not variable.

#9 User is offline   chikky 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 02-September 06

Posted 30 January 2007 - 06:32 AM

View PostSonic, on Jan 24 2007, 04:36 AM, said:

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.reg
del FixReg.reg
exit


This 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?

#10 User is offline   Sonic 

  • Sonic
  • Group: Patrons
  • Posts: 1,595
  • Joined: 04-December 03

Posted 03 February 2007 - 12:59 PM

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.

#11 User is offline   FenyX 

  • Group: Members
  • Posts: 6
  • Joined: 20-August 06

Posted 10 October 2007 - 10:26 PM

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 :rolleyes: ).

#12 User is offline   Sonic 

  • Sonic
  • Group: Patrons
  • Posts: 1,595
  • Joined: 04-December 03

Posted 11 October 2007 - 01:18 PM

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.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy