Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Creating a shortcut to %UserProfile% without expanding the variable

Featured Replies

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 Data

What is the correct way to do it?

maybe try

"^%windir^%" with quotes? maybe try double quotes? paste more of the code your using?

Edited by MCT

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 h
HOMEDRIVE=I:
HOMEPATH=\

[I:\]set u
USERDOMAIN=PENNING
USERNAME=wendy
USERPROFILE=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 all
LinkName: homedir.lnk
Arguments: /e,%Userprofile%
Target: I:\FENSTER\explorer.exe
Working Directory: <none>
Icon File: <none>
Icon Index: 0

shortcut is from the NT4 reskit, is an NT version of the 95 utility.

Edited by os2fan2

  • Author

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!

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%%).

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 folder

Save as QL_CalcSC.vbs

Dim 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

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.

  • Author

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.

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.