#1 27 Nov 2012 07:38

carlos
Member
From: Chile
Registered: 04 Nov 2008
Posts: 232
Website

[Undocumented] SUBST

Hello. I'm not really sure if this was documented before. But, some seconds ago I found this for error and I'm really surprised and happy of the result.
I using Windows 7.
I found that SUBST command accept other letters in the drive letter (not the typical A-Z of all the life), but Windows Explorer only shows the A-Z letters:

I use for example:

SUBST $: "%TEMP%"

And now you not view the $ in the window explorer, but if you use:

$:

No, you have in the Temp directory, but mapped with the volume $:
Also, I use:

SUBST :: "%TEMP%"
SUBST !: "%TEMP%"
SUBST 9: "%TEMP%"

and many other characters.

Then, this have some benefits. You can map a folder as a volume inside a batch, and you not view this in the explorer of windows. Also, you can increment the possibilities of map a drive letter unused.

Also, I found that subst command executed without parameters, show the folder mapped with it, but only A-Z
If you use for example:

SUBST #: "%TEMP%"
SUBST B: "%TEMP%"

And you run SUBST you get:

B:\: => C:\Users\Carlos\AppData\Local\Temp

but you not be informed of the existence of #: you only can remember it.



Carlos.

Last edited by carlos (27 Nov 2012 09:26)

Offline

#2 14 Jul 2013 19:24

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 769
Website

Re: [Undocumented] SUBST

I have added a note about this to the SUBST page - thanks Carlos

Offline

#3 02 Aug 2013 02:03

probyn
Member
From: El Cerrito, CA, USA
Registered: 02 May 2013
Posts: 2

Re: [Undocumented] SUBST

I read this post a while ago and something was nagging me about it. Do any of these show up when you type 'set "' at the CMD prompt?  (That's   S E T <space> <double-quote>  )  The so-called 'undocumented system variables' should include the names of whatever directories are current on whatever various hard drives you have, etc. (There won't be any in the list if you haven't referenced any in your current console session.)

----------screen capture Win 7------------------
C:\Users\Phil>set "
=::=::\
=C:=C:\Users\Phil
big_smile:=D:\
=E:=E:\
=F:=F:\Wylbur
=G:=G:\
=K:=K:\CMD\DATA
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Phil\AppData\Roaming
cmdpath=c:\Cmd;c:\Cmd\test;c:\Cmd\util
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
etc., etc., etc.,
-----------end screen capture---------------------

I have some SUBSTs in effect but only in WinXP under WinVPC

  H:\: => UNC\tsclient\c
  K:\: => UNC\tsclient\k
  X:\: => UNC\tsclient\f

to access the host Win 7 hard drive; these don't show up for
me in the output of 'set "'.

--
Phil Robyn
Univ. of California, Berkeley
ude tod yelekreb ta nyborp

Offline

#4 02 Aug 2013 15:07

dbenham
Member
From: U.S. east coast
Registered: 15 Apr 2012
Posts: 100

Re: [Undocumented] SUBST

Yes - They show up for me in Win7 once the mapped drive is referenced. The variable remains even after the mapped drive is undefined!

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

P:\>set ^"|findstr "^="
=P:=P:\

P:\>subst $: "%temp%"

P:\>set ^"|findstr "^="
=ExitCode=00000000
=P:=P:\

P:\>$:

$:\>p:

P:\>set ^"|findstr "^="
=$:=$:\
=ExitCode=00000000
=P:=P:\

P:\>subst $: /d

P:\>set ^"|findstr "^="
=$:=$:\
=ExitCode=00000000
=P:=P:\

P:\>$:
The system cannot find the drive specified.

P:\>set ^"|findstr "^="
=$:=$:\
=ExitCode=00000000
=P:=P:\

P:\>

Dave Benham

Offline

#5 05 Feb 2014 23:23

SmartGenius
Member
Registered: 11 Dec 2008
Posts: 26

Re: [Undocumented] SUBST

Esto me ha gustado bastante, siempre me he apegado a las "reglas de sintaxis" de cada comando y en base a ello hago cosas, tu experimentas nuevas posibilidades wink

el comando SUBST es la base del script de "Virtual Drive" (si lo recuerdas) y con este descubrimiento quedaria aun mejor al no reflejarse en el explorador cual es la unidad que usa para guardar las cosas, o hacer algo aun mejor wink

Saludos brother big_smile

Offline

Board footer

Powered by FluxBB