Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 66,999 of 68,980    |
|    Tim Rude to All    |
|    Expand a variable within a variable    |
|    13 Aug 17 21:58:46    |
      From: timrude.nospam@nospam.hotmail.com              I'm trying to obtain the current user's desktop path to pass as a       command-line parameter to an old DOS app that will be running under       Win7/8/10.              I can get the path from the registry using:              for /f "usebackq tokens=1,2,*" %%B IN (`reg query       "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User       Shell Folders" /v Desktop`) do set DT=%%D              On a default install of Win7, that sets the %DT% environment variable to       '%USERPROFILE%\Desktop' since that's what's stored in the registry.              However, I need the '%USERPROFILE%' part expanded to the actual path, so       that I end up with %DT% being (for example) 'C:\Users\Tim\Desktop'.              How can I get my batch file to expand the %USERPROFILE% variable that's       within the %DT% environment variable?              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca