How to? Runs start /w in invisible mode OR run program after exit of another one

Mar 4, 2020
18
0
Hello

I need to run one program right after exit of another one, i.e. to run backup after I edit file in MSAccess or other program.
For that purpose I run bat file like

----------current-approach,bat--------------
start "" /w /max /dc:\bat "C:\Office2003\office11\MSACCESS.EXE" test.mdb
call bsa.bat
cls
------------------------

It works fine except Windows 7 shows both MSAccess and each its openned table as a separate program/window when I press Alt-Tab. So I can't do much about that but I would like to delete from the list of running windows at least the window for bat files itself. I can run bat file minimised, but that creates even more inconvenience. I don't want to compile bat files into exe file.

Questions:

1) may be start /w is not the right path altogether/which one is right on ?
2) how to run bat file via cmd or TCC/TCDM so it does not show in the list of openned windows ?


thank you
 

samintz

Scott Mintz
May 20, 2008
1,414
13
Solon, OH, USA
If the goal is to run bsa.bat *after* MSACCESS exits, then get rid of the START command and run it directly.
Code:
pushd c:\bat
"C:\Office2003\office11\MSACCESS.EXE" test.mdb 
popd
call bsa.bat
cls
I assume, you run current-approach.btm by double-clicking it from an Explorer window (as opposed to running it from within TCC). That will launch the current BAT handler and run the script - typically something like TCC /C current-approach.bat. That opens the command prompt window which you will see along with the MS Access window.

If you want the script to run in detached state, then you'll need a launcher script.
Create LaunchDB.btm:
Code:
detach current-approach.btm
When running detached, a console app cannot access the keyboard, mouse, or display. So your current-approach.btm script can be simplified a little. Since the CLS command is meaningless in a detached script, you can remove the CALL and the CLS commands.
Code:
"C:\Office2003\office11\MSACCESS.EXE" c:\bat\test.mdb 
c:\bat\bsa.bat
 
  • Like
Reactions: Sergey Vontsov