Variable Path in .reg File?
Variable Path in .reg File?
Variable Path in .reg File?
Variable Path in .reg File?
Variable Path in .reg File?
Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File?
Variable Path in .reg File? Variable Path in .reg File?
Variable Path in .reg File?
Go Back  Xtreme Visual Basic Talk > > > Variable Path in .reg File?


Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2013, 02:18 PM
bobcory's Avatar
bobcory bobcory is offline
Contributor
 
Join Date: Jun 2003
Location: NW UK
Posts: 454
Question Variable Path in .reg File?


I have a .reg file which my users (assuming there are any) can make file associations. It looks like this

Code:
Windows Registry Editor Version 5.00]

[HKEY_CLASSES_ROOT\msctfile]
@="MyProg"

[HKEY_CLASSES_ROOT\msctfile\DefaultIcon]
@="C:\\Program Files\\MyProg Organisation\\MyProg\\MyProg.exe,1"

[HKEY_CLASSES_ROOT\msctfile\shell]

[HKEY_CLASSES_ROOT\msctfile\shell\open]

[HKEY_CLASSES_ROOT\msctfile\shell\open\command]
@="C:\\Program Files\\MyProg Organisation\\MyProg\\MyProg.exe %l"
Now this works fine on Win XP but on Win 7 and Win 8 the correct file path is:
"Program Files (x86)" instead of "Program Files" so really I want something where the last line looks like

Code:
@="[APPDIR]MyProg.exe %l"
Anybody know how to do this?
Thanks!
.
Reply With Quote
  #2  
Old 10-31-2013, 03:34 PM
Icehawke Icehawke is offline
Newcomer
 
Join Date: Aug 2013
Location: Elgin IL
Posts: 17
Default

Try this for your data value: %AppDir%\MyProgram.exe "%1"
Reply With Quote
  #3  
Old 10-31-2013, 04:08 PM
bobcory's Avatar
bobcory bobcory is offline
Contributor
 
Join Date: Jun 2003
Location: NW UK
Posts: 454
Default

Quote:
Originally Posted by Icehawke View Post
Try this for your data value: %AppDir%\MyProgram.exe "%1"
Icehawke
Thanks for that but I am struggling to make it work. So I replace:

@="C:\\Program Files\\My Organisation\\Myprog\\Myprog.exe %l"

with what exactly?
.
Reply With Quote
  #4  
Old 10-31-2013, 04:21 PM
Icehawke Icehawke is offline
Newcomer
 
Join Date: Aug 2013
Location: Elgin IL
Posts: 17
Default

@= "%AppDir%\MyProg.exe %1"
Reply With Quote
  #5  
Old 10-31-2013, 04:36 PM
bobcory's Avatar
bobcory bobcory is offline
Contributor
 
Join Date: Jun 2003
Location: NW UK
Posts: 454
Default

Does not seem to work unfortunately but thanks for helping!

.
Reply With Quote
  #6  
Old 10-31-2013, 08:30 PM
PlausiblyDamp's Avatar
PlausiblyDampVariable Path in .reg File? PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Try
Code:
@="%ProgramFiles%\\MyProg Organisation\\MyProg\\MyProg.exe %l"
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #7  
Old 11-01-2013, 04:06 AM
bobcory's Avatar
bobcory bobcory is offline
Contributor
 
Join Date: Jun 2003
Location: NW UK
Posts: 454
Default

Yes, in principle that seems to be the correct answer so many thanks!

It seems that the "Type" in the Registry for that entry needs to be set at REG_EXPAND_SZ which is evidently hex(2) but I cannot see how to change my last line - I assume it needs to look something like:

@=hex(2):"%ProgramFiles%\\MyProg Organisation\\MyProg\\MyProg.exe %l"

probably with %ProgramFiles%\\MyProg Organisation\\MyProg\\MyProg.exe %l expanded to a hex string which sounds like a chamber of horrors ...

Edit;
This is what I needed

[HKEY_CLASSES_ROOT\mpktfile\shell\open\command]
@=hex(2):25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6 c,00,65,\
00,73,00,25,00,5c,00,4d,00,4f,00,50,00,45,00,4b,00,53,00,20,00,4f,00,7 2,00,\
67,00,61,00,6e,00,69,00,73,00,61,00,74,00,69,00,6f,00,6e,00,5c,00,4d,0 0,4f,\
00,50,00,45,00,4b,00,53,00,5c,00,4d,00,4f,00,50,00,45,00,4b,00,53,00,2 e,00,\
65,00,78,00,65,00,20,00,25,00,4c,00,00,00

I mean, what could be simpler? Thank you Microsoft for making our lives so interesting ...

Idiots Guide
1. Create an entry by doing
[HKEY_CLASSES_ROOT\mpktfile\shell\open\command]
@=hex(2):25,00

2. Change it to what you want using modify

3. Export it and save - you then have your string!

Bob
.

.

Last edited by bobcory; 11-01-2013 at 04:57 AM.
Reply With Quote
  #8  
Old 11-01-2013, 04:49 AM
PlausiblyDamp's Avatar
PlausiblyDampVariable Path in .reg File? PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

@=REG_EXPAND_SZ:"C:\\Program Files\\MyProg Organisation\\MyProg\\MyProg.exe %l"
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #9  
Old 11-01-2013, 05:57 AM
bobcory's Avatar
bobcory bobcory is offline
Contributor
 
Join Date: Jun 2003
Location: NW UK
Posts: 454
Default

It looks logical but I tried that and could not make it work. Everything I read suggests that you have to do it the hard way. Maybe I am missing something?

Many thanks anyway, at least I now have a solution that works even if it is pretty cumbersome
Bob
.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Variable Path in .reg File?
Variable Path in .reg File?
Variable Path in .reg File? Variable Path in .reg File?
Variable Path in .reg File?
Variable Path in .reg File?
Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File? Variable Path in .reg File?
Variable Path in .reg File?
Variable Path in .reg File?
 
Variable Path in .reg File?
Variable Path in .reg File?
 
-->