running program from script and (not) returning to script

Jun 3, 2008
130
3
Temecula, CA
I'm running an program which, if I run it directly from the command line, starts up the program and my TCC (v. 16.03, Windows 7-64) window returns me to my command prompt, with the program running happily in the foreground. If I run that same program from within a batch (.BTM) file, the program starts, but my batch file is paused, waiting until my program terminates. How do I get it to start that program but just return immediately to my batch script?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
Without the /PGM, the first quoted string is interpreted as the title for a new console window -- probably not what you want. Yes, this syntax is bizarre! It's for CMD.EXE compatibility, of course.
 
Jun 3, 2008
130
3
Temecula, CA
Code:
START /PGM "c:\path to\my\proggy.exe"
or
Code:
START "" "c:\path to\my\proggy.exe"

OK, I've figured out that there's a twist I didn't realize was significant, but have now determined that it is. If I use the simple
Code:
START "" prog.exe arg1 arg2
, it works properly. However, the twist is that instead of prog.exe, I have an alias that is as basic as it comes - the alias simply defines the program to run.

I've fixed it by merely using a system environment variable to define the program to run instead of an alias. However, I am curious why using an alias here causes it to create a new TCC window.
 

rconn

Administrator
Staff member
May 14, 2008
12,369
150
OK, I've figured out that there's a twist I didn't realize was significant, but have now determined that it is. If I use the simple
Code:
START "" prog.exe arg1 arg2
, it works properly. However, the twist is that instead of prog.exe, I have an alias that is as basic as it comes - the alias simply defines the program to run.

I've fixed it by merely using a system environment variable to define the program to run instead of an alias. However, I am curious why using an alias here causes it to create a new TCC window.

If the command that you're passing to START is an internal command, alias, or batch file, START will start another TCC.EXE session to execute it.
 
Jun 3, 2008
130
3
Temecula, CA
If the command that you're passing to START is an internal command, alias, or batch file, START will start another TCC.EXE session to execute it.

Oh, so START is the pure CMD implementation. There's no TCC (TCMD) version of it that could shield it from something like that. Might I suggest (at a very low priority) that there be a TCC version of START that can treat the internal commands and aliases as not having to start another TCC session? Basically, I thought that having an alias there would be exactly the same as having the actual program there, just like the environment variable case is handled. But I'm OK even if you choose not to implement this. As long as I understand how it works, which I now do. :smile:
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
Thinking further about your issue: Rather than updating all your batch files to use START, it might be smarter to change your alias to START /PGM "PROGGY.EXE". The new alias ought to work the same at the command line -- but do what you expect in batch files.
 
Jun 3, 2008
130
3
Temecula, CA
I'll keep that in mind for future applications. I only had one batch file for this particular issue, and simply changing from an alias (that was otherwise unused anyway) to an environment variable was simple and straightforward. But thanks for the great suggestion!
 

rconn

Administrator
Staff member
May 14, 2008
12,369
150
Oh, so START is the pure CMD implementation. There's no TCC (TCMD) version of it that could shield it from something like that. Might I suggest (at a very low priority) that there be a TCC version of START that can treat the internal commands and aliases as not having to start another TCC session? Basically, I thought that having an alias there would be exactly the same as having the actual program there, just like the environment variable case is handled. But I'm OK even if you choose not to implement this. As long as I understand how it works, which I now do. :smile:

The START in TCC is vastly expanded versus the START in CMD. However, there's no way that you can run an alias, batch file, or internal command by itself, so TCC has to invoke another copy of TCC to execute it. (If you didn't want another TCC session, there wouldn't have been any point in using START in the first place.)
 
Similar threads
Thread starter Title Forum Replies Date
MickeyF running a program from cmdline versus in batch file Support 1
J 4NT Error when running 'system' from a program to execute a .BTM Support 3
vefatica Running services.msc? Support 1
gentzel Directory stack empty when running TCEXIT? Support 9
A Fixed [23.0.22]: TCMD crashes shortly after start, TCC keeps running in background Support 6
J Error running Python at command line Support 9
Peter Murschall Uninstall CMDEBUG is not running Support 3
T Fixed IDE locks up if edit window for running batch is closed Support 6
C Running PowerShell_ISE in a Tab Support 7
B How to get window status of a running app Support 3
rconn News Website & Forums now running PHP 7 Support 0
D Running v19 breaks v18 Support 1
vefatica JUMPLIST item when pinned TCMD isn't running? Support 0
B Batch file won't run if there is already an instance of TC 17 running Support 9
rjperrella start /tabna leaves blank windows when running batch scripts Support 10
T Fixed TCC 17: Error running Chocolatey Package Manager Support 3
vefatica Caption when running elevated? Support 4
C Determine process svchost is running Support 13
F Minimising the command window running from a batch file Support 19
D How to? Problem running Mercurial with Araxis Merge Support 3
vefatica Running TCMD's help on the services desktop Support 0
H Ruby - Running External Ruby script crashes TCC Support 11
J TC12 Win7 console, running gawk scripts Support 0
M Running a batch file at Windows startup... Support 8
vefatica Browser doesn't start while IDE is running Support 12
J Crash in 12.00.27: Running any git command from Git for Windows Support 10
nikbackm Running several TCMD versions side-by-side - config files Support 7
R No Error Message when running mklink as limited user Support 3
B Installed/Running in Windows 7? Support 3
mscheuner Running one tab as Vista admin - ERROR Support 1
deleyd command that launches batch file running TCMD? Support 6
p.f.moore Running another batch file without CALL Support 7
C Add link to ewriter help to program group... Support 3
H Behavior change re piping a string to a Java program Support 1
S How to? Runs start /w in invisible mode OR run program after exit of another one Support 3
W Starting program for word to pdf conversion (difference cmd and tcc) Support 13
MickeyF Why doesn't my python program get executed without specifying its path? Support 2
R How to? START program as top window? Support 2
M "less" program that works in TC 18 Support 12
C INSTALLED returnes same program multiple times Support 14
C Recommend a Print program Support 1
C tcmd.ini not loading from program dir? Support 5
Joe Caverly Determine if program started from command prompt Support 2
C WAD TCC: (Sys) C:\Program Files\JPSoft\TCMD17\tcc.exe is not a valid Win32 application. Support 6
C Win7 Program Data.... Support 2
M How to? Start a program on log on elevated abovenormal Support 5
MickeyF how to determine which program will execute a file Support 10
D New 64-bit install goes to Program Files x86 Support 3
M How is this program found? Support 9
A How to? Run a TCC command from external program Support 2

Similar threads