[AccessD] A2K:OT: Get a batch file to quit or close

Jim Lawrence (AccessD) accessd at shaw.ca
Thu Aug 28 23:15:03 CDT 2003


Hi All:

Just a comment about opening a batch file window and having it close when
finished. I just write the file as normal, in notepad with something like:

net time \\192.168.123.161 /set /yes
exit

and save the file as say 'c:\temp\time.bat'
then set it up in caller program, in this case I used the Task Scheduler and
right-mouse click and select 'run'.

A command window appears and the contents of the batch file are processed
but the window still remains open.

The trick is to then 'right-mouse' click to top left corner of the open
command window, select properties and tick the check-box that says 'close on
exit'. After that every time the batch file is ran from windows, it
automatically closes when it finishes.

Simple.

HTH
Jim


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart
McLachlan
Sent: Thursday, August 28, 2003 8:22 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] A2K:OT: Get a batch file to quit or close


On 28 Aug 2003 at 19:51, Drew Wutka wrote:

> The problem is that the batch file 'called' the app.  It isn't going to
> close, until the app closes.  A simple way around this would be to have a
> little VB .exe Shell out to the app, then close.  Then have your batch
file
> call your VB.exe, since it closes once it's run the shell command,
> everything should close right away.
>
> Then again, if you are shelling out with VB, why would you need a batch
> file! <grin>
>

Because the batch file does other things as well?
People like Darren aren't like you me - we enjoy knocking up a new
compiled app for this or that :-)

But that is actually a good idea of yours. A simple Shell app that
you can put in a batch file so that the batch can be closed while the
final called app is still running ( or just to do other things
asynchronously in a batch file).

Wait a minute......

Ok, I'm back.

You can download it as http://www.lexacorp.com.pg/soft/Shell.zip
Its' a 5KB zip file containing the program Shell.exe.

Here's the complete PB/Win Source for the application:

/*Contents of file Shell.Bas

FUNCTION PBMAIN AS LONG
    LOCAL strMessage AS STRING
    IF COMMAND$ > "" THEN
        FUNCTION = SHELL(COMMAND$)
    ELSE
        strMessage =  _
          "Run commands in a batch file asynchronously. " &
CHR$(13,10,13,10) _
          & "Usage: SHELL commandline" & CHR$(13,10,13,10) _
          & "Another free utility from Lexacorp" & CHR$(13,10) _
          & "http://www.lexacorp.com.pg"

        MSGBOX strMessage,,"Shell.Exe"
    END IF
END FUNCTION

End of file Shell.Bas */


--
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System
Support.



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list