random0xff Posted October 12, 2008 Share Posted October 12, 2008 This is from the shortcut.exe documentation:"To prevent an environment variable from being expanded until the shortcut is launched, use the ^ carat escape character like this: ^%WINDIR^%"But when I try that (with userprofile env variable), all I get is a shortcut to C:\^%UserProfile^%I also tried %%UserProfile%% and I got C:\%C:\Documents and Settings\Administrator%\Application DataWhat is the correct way to do it? Link to comment Share on other sites More sharing options...
MCT Posted October 12, 2008 Share Posted October 12, 2008 (edited) maybe try "^%windir^%" with quotes? maybe try double quotes? paste more of the code your using? Edited October 12, 2008 by MCT Link to comment Share on other sites More sharing options...
os2fan2 Posted October 12, 2008 Share Posted October 12, 2008 (edited) Ye note the second attempt, with the double %% signs, is correct, ectept ye do not need to prefix the drive, viz%%userprofile%%You should note under Windows Vista ye get different variables, because vista moved all of the common locations.Here is win2k, on my box.[I:\]set hHOMEDRIVE=I:HOMEPATH=\[I:\]set uUSERDOMAIN=PENNINGUSERNAME=wendyUSERPROFILE=I:\USERS\wendy[I:\]note here that userprofile points to the location of the user profile (NTUSER.DAT). which is usually located in the root of the home directory.HOMEDRIVE and HOMEPATH could point to directories where the user data is stored.None the same, this worked.[I:\]cd %userprofile%[I:\USERS\wendy]"shortcut" -n homedir.lnk -t explorer.exe -a /e,%%Userprofile%%[I:\USERS\wendy]"shortcut" homedir.lnk -u allLinkName: homedir.lnkArguments: /e,%Userprofile%Target: I:\FENSTER\explorer.exeWorking Directory: <none>Icon File: <none>Icon Index: 0shortcut is from the NT4 reskit, is an NT version of the 95 utility. Edited October 12, 2008 by os2fan2 Link to comment Share on other sites More sharing options...
random0xff Posted October 12, 2008 Author Share Posted October 12, 2008 No, this shortcut.exe is not from the resource kit. It's from http://www.optimumx.com/download/Here's the code I tried (from a batch file):shortcut.exe /f:"%UserProfile%\Application Data.lnk" /a:C /t:"^%UserProfile^%\Application Data"Thanks for looking! Link to comment Share on other sites More sharing options...
Ascii2 Posted October 13, 2008 Share Posted October 13, 2008 No, this shortcut.exe is not from the resource kit. It's from http://www.optimumx.com/download/I had tried the shortcut.exe utility some time ago. I opted not to use it because it generated invalid shortcuts (Windows often corrected the shortcut problems on run, however).If you want a utility to generated shortcuts, I would recommend XXMKLINK ( http://www.xxcopy.com/xxcopy38.htm ). It uses double a "%" charcter on each side of an evironmental variable to include the variable in the shortcut (example %%SystemDrive%% or %%SystemRoot%%). Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 13, 2008 Share Posted October 13, 2008 Have you thought about using a VBS script to make the shortcuts.This script makes a shortcut for Calculator and places it in the quicklaunch folderSave as QL_CalcSC.vbsDim Act, ObjSC, QuickLaunch, StrCalc Set Act = CreateObject("WScript.Shell") QuickLaunch = Act.ExpandEnvironmentStrings("%AppData%\Microsoft\Internet Explorer\Quick Launch") StrCalc = Act.ExpandEnvironmentStrings("%SystemRoot%\system32\calc.exe") Set ObjSC = Act.CreateShortcut(QuickLaunch & "\Calc.lnk") ObjSC.Description = Act.ExpandEnvironmentStrings("%UserName%") & " Open Calc.exe" ObjSC.TargetPath = StrCalc ObjSC.Save Link to comment Share on other sites More sharing options...
Yzöwl Posted October 14, 2008 Share Posted October 14, 2008 The utility as you stated does seem to incorrectly exhibit this behaviour; you have done nothing wrong, the utility is in error.shortcut.exe /f:"%UserProfile%\Application Data.lnk" /a:C /t:"^%UserProfile^%\Application Data"Why though would you want to create a shortcut to the Users Application Data folder and store it inside the Users Application Data folder and give it the name Application Data?It can be done, I have done so successfully, however since its only purpose would be to act as a `directory refresh` I see little point in uploading my solution. If you'd like to give us a real example of what exactly it is you want I'll see what I can do to help you further. Link to comment Share on other sites More sharing options...
random0xff Posted October 17, 2008 Author Share Posted October 17, 2008 No it would be a link to the app data from the profile. When files are hidden, you can't browse to the app data folder. With the shortcut in the profile, you can (without having to type in the address bar or showing hidden files). Just a small tweak I like. Link to comment Share on other sites More sharing options...
Yzöwl Posted October 17, 2008 Share Posted October 17, 2008 Okay, I understand your reasoning for the location in %userprofile%, as opposed to the %appdata% folder you gave in your example.Try the compiled batch file in the archive below.Its content is one single .cmd file, there is no third party utility included or required.Due to the nature of the compilation and the hidden window Anti-Malware programs may not like this file.Please judge for yourself whether you wish to run it!_AppData.zip Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now