Windows Legacy OS forum

General discussion

Windows Environment Variables in a Shortcut

by brian4xp / March 21, 2007 3:31 AM PDT

I have a thumbdrive with some files and apps I use when taking work home to work on there.

I have Aida32 in a folder on that drive (yes it's old but still somewhat useful). I would like to have a shortcut to the exe in the Aida folder in the root of the drive so I can run it from there. I can create one just fine, the only problem is the drive letter won't always be the same. So, I have to edit the shortcut to change the drive letter if I want to use it.

I found there is an environment variable %cd% which is the current directory. I tried to use that in the shortcut, but it won't accept it. I get a "The name '%cd%Aida\aida32.exe' specified in the Target box is not valid. Make sure the path and file name are correct".

Is it possible to do this or not? I have tried quotes around the whole string but that didn't fly either.

Discussion is locked
You are posting a reply to: Windows Environment Variables in a Shortcut
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Windows Environment Variables in a Shortcut
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Google might help
by MarkFlax Forum moderator / March 21, 2007 3:56 AM PDT
Collapse -
Example.
by R. Proffitt Forum moderator / March 21, 2007 4:05 AM PDT

C:\tmp>echo %cd%
C:\tmp

C:\tmp>echo %CD%
C:\tmp

Ok, it's not case sensitive but it is a batch file command and not something you'll put in a shortcut. If you take another look you see you also have a missing backslash.

Bob

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

GIVEAWAY

We are giving away 'Black Panther' swag!

Four lucky readers will be taking home *Marvel*ous "Black Panther" prizes, including magazines autographed by the King of Wakanda himself! Giveaway ends Feb. 25, 2018.