Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using SUBST in batch file

3,067 views
Skip to first unread message

Joe Boy

unread,
Jun 20, 2008, 10:37:54 PM6/20/08
to
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

Timo Salmi

unread,
Jun 21, 2008, 1:34:03 AM6/21/08
to
Joe Boy <joe...@invalid.invalid> wrote:
> I want to use a batch file using the SUBST command

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:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FI-65101, Finland
Useful CMD script tricks http://www.netikka.net/tsneti/info/tscmd.htm

Herbert Kleebauer

unread,
Jun 21, 2008, 2:26:42 AM6/21/08
to

Joe Boy wrote:
>
> 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 ............

Don't use "subst.bat" as the name for your batch file.

Joe Boy

unread,
Jun 21, 2008, 2:38:25 AM6/21/08
to
On Sat, 21 Jun 2008 08:26:42 +0200, Herbert Kleebauer <kl...@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

Joe Boy

unread,
Jun 21, 2008, 2:40:12 AM6/21/08
to
On Sat, 21 Jun 2008 08:34:03 +0300, Timo Salmi <t...@uwasa.fi> wrote:

>Joe Boy <joe...@invalid.invalid> wrote:
>> I want to use a batch file using the SUBST command
>
>Which OS?
>
> All the best, Timo

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

But see my reply to Herbert.

Thanks for replying.

--
Joe Boy

Timo Salmi

unread,
Jun 21, 2008, 6:52:14 AM6/21/08
to
Joe Boy <joe...@invalid.invalid> wrote:

> Herbert Kleebauer <kl...@unibwm.de> wrote:
>>> subst I: c:\dir1
>>> subst K: c:\dir2
>>> But when I run the batch file I get a continuous non-stop display as

>> Don't use "subst.bat" as the name for your batch file.

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

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.

Joe Boy

unread,
Jun 21, 2008, 9:18:03 PM6/21/08
to
On Sat, 21 Jun 2008 13:52:14 +0300, Timo Salmi <t...@uwasa.fi> wrote:

>Joe Boy <joe...@invalid.invalid> wrote:
>> Herbert Kleebauer <kl...@unibwm.de> wrote:
>>>> subst I: c:\dir1
>>>> subst K: c:\dir2
>>>> But when I run the batch file I get a continuous non-stop display as
>
>>> Don't use "subst.bat" as the name for your batch file.
>
>> So you are psychic or know this problem of old! :-)
>
>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

G'Day Timo

Thanks for the tip.
--
Joe Boy

park...@gmail.com

unread,
Apr 24, 2014, 10:35:56 AM4/24/14
to
LOL, Cheers for that had the same problem 2 mins ago, duh!

pyotr filipivich

unread,
Apr 25, 2014, 12:30:41 AM4/25/14
to
park...@gmail.com on Thu, 24 Apr 2014 07:35:56 -0700 (PDT) typed in
alt.msdos.batch the following:
I created a batch file to create a command prompt. Named it
"cmd.bat" Same problem
--
pyotr filipivich.
Just about the time you finally see light at the end of the tunnel,
you find out it's a Government Project to build more tunnel.

omar.v...@gmail.com

unread,
Nov 26, 2015, 2:51:19 AM11/26/15
to
I also just did that lol

0 new messages