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 67,004 of 68,980    |
|    Tim Rude to Herbert Kleebauer    |
|    Re: Expand a variable within a variable    |
|    14 Aug 17 16:57:14    |
      From: timrude.nospam@nospam.hotmail.com              On 8/14/2017 4:25 PM, Herbert Kleebauer wrote:       > On 14.08.2017 21:50, Tim Rude wrote:       >       >>>> 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       >>       >> but if there is a nifty way to do something similar using the SET       >> command, I'm all ears.       >       > Replace:       > do set DT=%%D       >       > by:       > do call set DT=%%D       >              Interesting!              However, the second 'for' statement in my working batch file did double       duty. In addition to expanding %DT% it also converted the expanded path       into it's short filename equivalent using the ~s modifier.              for /f "usebackq tokens=*" %%I in (`echo %DT%`) do set DESKTOP=%%~sI              If I try to roll the ~s modifier into your corrected first 'for'       statement it doesn't work properly. I get the expanded path tacked onto       the current path. I.e., the following doesn't work right:              for /f "usebackq tokens=1,2,*" %%B IN (`reg query       "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User       Shell Folders" /v Desktop`) do call set DT=%%~sD              So it seems I need to do the second 'for' statement anyway to do the       short filename conversion.              --- 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