By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

how to terminate tcc/le using /h

Hello, I can not figure out how to terminate tcc/le when I use the /h (hidden) switch.
I am using Quick Batch File Compiler to make an unattended exe file to run "program".
Batch file looks like this. %myfiles% calls embedded files.

start %myfiles%\"program"
%myfiles%\tcc /h keystack /w50 enter /w400 tab [2] enter

I am able terminate the process with out the /h by using Keystack but can not figure how to terminate Tcc/le with /h since keystack only work with active window.
Any help is apreciated.
With /c before "keystack", keystack does not perform the keystrokes. Tcc/le flashs briefly (terminates the Tcc process) and the "program" just stays open. I did place the /c after the keystack, it does nothing. Some time after the initial post I got it working.

start /b %myfiles%\tcc /h keystack /w40 enter /w420 tab [2] enter & %myfiles%\"program"
timeout 1
taskkill /f /im tcc.exe /t

Cmd and Tcc/le windows are hidden. Only "program" window (active window) stays open until it receives all the keystrokes. Finally with taskkill, Tcc.exe process ends.

I still want to figure out how to terminate Tcc/le with internal commands only.
By using the /C startup option, as David suggested; or with the EXIT command.

Are you trying to run %myfiles\"program" in the child shell? If so, I think you need to escape the ampersand.
Charles Dye,
I have noticed that /c works with exe files ("program"). Exe starts, blank Tcc/le screen pops up and waits for exe to close. Then Tcc process terminates. The problem is that I need keystack to work at the same time (or keystack to work while "program" is open). Here are some combos I tried (simplified) and the results.

Tcc /c keystack & "program" keystack (Tcc/le) closes/terminates immediately then "program" starts and stays open, no key press
Tcc /c "program" & keystack Tcc/le waits for "program" to close in order to continue eventhough "&" is used.

Separate lines does not work because Tcc /c keystack will immediately terminate.
Several attempts with exit also failed for me. Somehow /c does work with Tcc/le internal commands.

As for %myfiles%\, it is required by http://www.abyssmedia.com/quickbfc/ . It is an exe file maker that cam embed all Tcc/le file and other programs. Sorry if it got confusing. I also tried at the cmd terminal with out the %myfiles%\. Either way, no luck.
I'm not sure what you are doing. Are you writing a btm file or something else? If you tell us exactly what you are doing, then maybe we can help. But, as Charles said, you probably need to escape the ampersand if you are trying to pass it without having TCC act on it. So & would be ^& if ^ is your escape character. Or, put all the commands in a btm file and run it using TCC /c foo.btm, or just foo.btm if you are running it from TCC. But, it appears you are running from cmd, not TCC.
David Marcus,
My apologies if I did not explain in detail. I am making/assembling a single Portable exe file that contains/embeds Tcc/le files (exe, dll) plus additional non Tcc/le related exe files. Primary purpuse is to run the non Tcc/le exe files/programs unattended. Keystack function/command does what I need but the issue is that Tcc.exe does not terminat its process after main exe closes. With /h there are no open windows but Windows task manager shows that Tcc.exe is still running.

The bottom line (without all of the above) is that /c does not work with internal command(s?) (keystack). "start tcc /c keystack enter" statement does not work. Same statement without /c works fine. Exit requires a enter key press that can not be done with /h.
I am not an expert, so my apologies again if I am missing somthing that is very basic. Trying to make a app(exe) using /h Keystack (reqires vis. window) made things little more complicated. Without /h I am able to use the "exit" with keystack to terminate the Tcc/le process.
That doesn't answer my question. Show us the actual steps you've tried. The embedding tcc in an exe doesn't seem relevant, i.e., it seems that once you get it to work non-embedded, you can embed it. Are you trying to write a btm file? If so, show us what it looks like so far.
Dave Marcus,
I read all the posts again and tried to figure out/understand the ^& if ^ you have mentioned. It is little too much for me to digest it at this time.

start iexpress & tcc /h keystack /w30 tab [2] enter /w45 tab enter

I named the above line test.cmd and it works. This is very close to what I am trying to include into the exe. I made it so that you can run it if you want. That way we are looking at the same thing. It simply closed the iexpress. But Win task mngr shows that Tcc.exe process is still running after all the tasks are performed. Iexpress is just a random pick. It is a built in Win7/Xp feature/program.
I am simply trying to terminate the the process while using /h switch. Could not figure out hot to make /c work. Again I might be missing something simple . If the termination process using Tcc/le gets too complicated, "taskkill /f /im Tcc.exe" will be a simpler choice (it works, tested).

Sorry if I sound like a broken record. I don't have the ability to explain any other way.

I don't understand what is happening. I created c:\Junk\test.btm with

start iexpress & keystack /w30 tab [2] enter /w45 tab enter

and c:\Junk\test.cmd with

"C:\Program Files\JPSoft\TCmd13\TCC.exe" c:\Junk\Test.btm

Running test.btm from TCC worked. Clicking on test.cmd worked, but of course TCC didn't close. I changed test.cmd to

"C:\Program Files\JPSoft\TCmd13\TCC.exe" /c c:\Junk\Test.btm

and it no longer worked: TCC appears and disappears immediately; iexpress starts, but just sits there.
"but of course TCC didn't close"
""C:\Program Files\JPSoft\TCmd13\TCC.exe" /c c:\Junk\Test.btm
and it no longer worked: TCC appears and disappears immediately; iexpress starts, but just sits there."

With addition of /c, Keystack does not work. Looks like the Tcc bypasses keystack and closes. Therefore iexpress just sits.

Quote from Help/ tcstart and tcexit. "With the exception of some initialization switches, the entire startup command line passed to TCC " Further down,
" if you use a transient session (one started with the /C option) to run an individual command, then exit. The session will execute in the directory set by TCSTART, not the directory in which it was originally started (e.g., by specifying a working directory in a shortcut)"

I get a feeling that the second quote describes what is happening with insertion of /c. What do you think David? If that is the case /c is not very practical for portable apps.
"What happens if you put e.g. a DELAY 5 after the KEYSTACK command?"

As long as /c in place, no change.
I'm guessing, but maybe the keystroke-faking is being done in a separate thread which is terminated when the shell exits.

Similar threads