SUBST

Aug 10, 2017
13
0
I have a line in my alias.lst file:
subst w: c:<path>

The alias runs at start up with no errors and all of the other commands therein work as soon as I start TCC. But when I type w: I get an error message. If I type subst w: c:<path> at the command line in TCC I get the same result, no error message but no access to w:

If I open a CMD window and enter the same command everything works as expected. As an aside, after doing that and going back to my TCC window the w: drive is available.

Does TCC not support subst? Or is there a work around?

Dave
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,689
106
Albuquerque, NM
prospero.unm.edu
SUBST is an external command. You don't want to alias it, you just want to run it once at startup.

Or use PSUBST instead, in an elevated shell. That way your substitution persists through reboots, so you don't need to run it every time.
 

samintz

Scott Mintz
May 20, 2008
1,557
26
Solon, OH, USA
I wrote a BTM named PSUBST many years ago that still works near as I can tell.
 
Aug 10, 2017
13
0
SUBST is an external command. You don't want to alias it, you just want to run it once at startup.

Or use PSUBST instead, in an elevated shell. That way your substitution persists through reboots, so you don't need to run it every time.
I just located it in alias.lst so that it would run at startup. Where should I put it?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,689
106
Albuquerque, NM
prospero.unm.edu
TCSTART.BTM runs commands. You could put it there, and it will run every time you start TCC. Or create a batch file containing that command, and put it in your Start menu's "Startup" folder so it runs when you log in to Windows.

(Under Windows 10 it's not obvious how to find the Startup folder. start /pgm "%@shfolder[7]" will open it for you.)
 
May 20, 2008
12,173
133
Syracuse, NY, USA
I just located it in alias.lst so that it would run at startup. Where should I put it?
I run a BTM at logon. The BTM itself can go anywhere as long as there's a shortcut to it in the folder that Charles just mentioned. For me that's
Code:
C:\Users\vefatica\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

I don't do my SUBSTing in the logon BTM (but I could). I use the PSUBST method. It doesn't require maintenance (except in the event of a major Window's update, not the normal monthly ones). If you're in the Insider program DON'T use the PSUBST method because it's wiped out with every Insider update.

As an alternative to the StartUp folder you could use a scheduled task ...

trigger: login
action: [path\]tcc.exe
arguments: /c [path\]your_subst.btm
 
Aug 10, 2017
13
0
Sorry for the delay in getting back to you, but I discovered that whatever the status of my attempt at subst was, it persisted over exit and entry to tcc only appearing to be cleared by a system reboot and I hadn't rebooted for several days. In any case I did this morning and the psubst command in TCSTART.btm worked fine. For some reason subst did not work, but that's fine as I only need one solution. Thanks again for your help.