Tech Support > Operating Systems > MS-DOS > Using SUBST in batch file
Using SUBST in batch file
Posted by Joe Boy on June 21st, 2008


I want to use a batch file using the SUBST command - for example:-

subst I: c:\dir1
subst K: c:\dir2

But when I run the batch file I get a continuous non-stop display as
follows:-

C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
C:\>subst i: C:\dir1
and on and on ............

Am I missing something?

Is it possible to use SUBST in a batch file?

If so, what do I change?



--
Joe Boy

Posted by Timo Salmi on June 21st, 2008


Joe Boy <joeboy@invalid.invalid> wrote:
Which OS?

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/> ; FI-65101, Finland
Useful CMD script tricks http://www.netikka.net/tsneti/info/tscmd.htm

Posted by Herbert Kleebauer on June 21st, 2008



Joe Boy wrote:
Don't use "subst.bat" as the name for your batch file.

Posted by Joe Boy on June 21st, 2008


On Sat, 21 Jun 2008 08:26:42 +0200, Herbert Kleebauer <klee@unibwm.de>
wrote:

So you are psychic or know this problem of old! :-)

Now I feel quite stupid for making such a silly mistake!!

Many thanks for taking the time to put me straight.

Cheers ..............
--
Joe Boy

Posted by Joe Boy on June 21st, 2008


On Sat, 21 Jun 2008 08:34:03 +0300, Timo Salmi <ts@uwasa.fi> wrote:

Windows Vista, sorry - I should have said in the original post.

But see my reply to Herbert.

Thanks for replying.

--
Joe Boy

Posted by Timo Salmi on June 21st, 2008


Joe Boy <joeboy@invalid.invalid> wrote:
Using a command name also as a batch name is a subtle, but quite a
common mistake. A FAQ actually. E.g.
89} All of a sudden "echo." doesn't work any more. What's wrong?
http://www.netikka.net/tsneti/info/tscmd089.htm

If other ways are possible, I would recommend not using subst at all. At
least it might cause strange situations with Windows file deletes,
because the substituted drive letters seem to get a recycle bin of their
own.

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:ts@uwasa.fi <http://www.uwasa.fi/~ts/> ; FI-65101, Finland
Useful CMD script tricks http://www.netikka.net/tsneti/info/tscmd.htm

Posted by Joe Boy on June 22nd, 2008


On Sat, 21 Jun 2008 13:52:14 +0300, Timo Salmi <ts@uwasa.fi> wrote:

G'Day Timo

Thanks for the tip.
--
Joe Boy