[gptalk] Re: Shortcuts with Environment Variables

  • From: "Darren Mar-Elia" <darren@xxxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Wed, 3 Jan 2007 09:05:11 -0800

DC-
You probably need to create the shortcut on the fly using WSH if you really
want this to work. There's probably several ways you could skin this. First
off, Windows keeps paths to various installed executables in the registry
under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\, so you could query this for Excel.exe to find the definitive path to
Excel without having to mess with Environment variables. You could probably
do that using reg.exe in a batch file. Alternatively, you can certainly
expand environment variables in VBScript and create shortcuts on the fly as
well. You might want to check out these samples on the TechNet Scripting
Center:

http://www.microsoft.com/technet/scriptcenter/scripts/desktop/explorer/dmexv
b04.mspx
http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_aytf.mspx?mfr=tr
ue

Darren


Darren Mar-Elia
CTO & Founder
SDM Software, Inc.
www.sdmsoftware.com
darren@xxxxxxxxxxxxxxx

Speed Group Policy Troubleshooting with the NEW GPHealth Reporter tool at
http://www.sdmsoftware.com/products.php



-----Original Message-----
From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx] On
Behalf Of dcnash@xxxxxxxxxxxxx
Sent: Wednesday, January 03, 2007 8:11 AM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] Shortcuts with Environment Variables

Here is my situation, we have close to 150 computers, some with different
versions of office on them. We have some systems with Office XP installed
and some with Office 2003. They all run Windows XP. As you know office's
installation path for Office XP is c:\program files\microsoft
office\office10. The only difference between the installation path for XP
and 2003 is c:\*\office11 instead of c:\*\office10.
I'm trying to create a shortcut that points to excel.exe within the default
installation path for office. There is only one version of office installed
on each system therefore only ONE of these folders will exist.
So far Ive created an environment variable that points to c:\program
files\microsoft office\office*\. Ive named the environment variable Office.
When I open command prompt and type "cd %office%" it works beautifully. When
I create the shortcut it tries to resolve the folder path litterally as
"c:\%office%\excel.exe" instead of substituting the environment variable
value of "c:\program files\microsoft office\office*\"

I can create a batch file that runs it, copy that via login script to local
boxes, then create and run a shortcut that points to the batch file and
hides the command prompt window, but that would be a major pain in the
behind. Any ideas here? Im wondering if there is a vbscript or something
that will actually run the program for me from the correct folder path. I
dont know vbscript otherwise I would try and write this myself. Any help is
greatly appreciated!

Thanks guys!

DC Nash

***********************
You can unsubscribe from gptalk by sending email to
gptalk-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field OR by
logging into the freelists.org Web interface. Archives for the list are
available at http://www.freelists.org/archives/gptalk/
************************

***********************
You can unsubscribe from gptalk by sending email to 
gptalk-request@xxxxxxxxxxxxx with 'unsubscribe' in the Subject field OR by 
logging into the freelists.org Web interface. Archives for the list are 
available at http://www.freelists.org/archives/gptalk/
************************

Other related posts: