🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.misc
Article #10222

Re: DISABLING CTRL-C in BAT FILES...

#10222
From: Tooraj Enayati
Date: Fri, 01 Jan 1993 04:39
44 lines
2630 bytes
brogers@pro-storm.cts.com (Brian Rogers) writes:

>In <C01pBA.I4J@ccu.umanitoba.ca>
>ummalik@ccu.umanitoba.ca (Ijaz Rashid Malik) writes:
>>
>>Does anyone know of ANY way that would disable Ctrl-C &/or Ctrl-Break in
>>a BAT file. I have to shell to dos from a database app. (Paradox) to run
>>a BAT file and if user hits Ctrl-C during BAT file processing, every thing
>>gets ruined. I have to catch it somehow...

>It's been my experience that there's no real way to disable the Ctrl-C
>checking during a batch file -- HOWEVER, adding "BREAK=OFF" to your
>config.sys AND not doing any input or output from the batch file (eg: with
>the PAUSE command) will pretty much make sure that the batch file is not
>interrupted.  Still, this does not make sure that executables (eg: MORE.COM,
>ASSIGN.EXE, and utilities) run without being interupted by Ctrl-C.
>If you have to use commands such as COPY or others that produce output,
>redirect their output to nul (eg: COPY COMMAND.COM D:\ > NUL).

>Hope this helps.

>------- Brian Rogers -------+-------------- The Angel of Java ----------------
> "Staying Sane is Hard....  | Internet: brogers@pro-storm.cts.com          
>  Drinking Coffee is Easy!" |   Bitnet: brogers%pro-storm.cts.com@nosc.mil
>----------------------------+-------------------------------------------------

I can think of a way to do this, by writing a program (say in C) that
takes the batch file name from the command line and then redirects 
CTRL C to nothing (see Turbo C's help on signal() ) and the makes a 
call to system("batch_file_name.bat").

If you want I can send you the source code. All you need to do is to be
able to call the bach file with something like this:

ms-dos_prompt> c_program batchfile.bat


Hope it helps.

-- 
==============================================================================
Tooraj Enayati     Melbourne     Australia     tooraj@daneel.rdt.monash.edu.au
Monash University       Robotic and Digital Technology       (Graduate/Alumni)
==============================================================================
Technical Details
Message-ID: <tooraj.725863152@daneel.rdt.monash.edu.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!daneel.rdt.monash.edu.au!tooraj
References: <C01pBA.I4J@ccu.umanitoba.ca> <lu16104@pro-storm.cts.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.ibm.pc.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!daneel.rdt.monash.edu.au!tooraj
From: tooraj@daneel.rdt.monash.edu.au (Tooraj Enayati)
Subject: Re: DISABLING CTRL-C in BAT FILES...
Message-ID: <tooraj.725863152@daneel.rdt.monash.edu.au>
Sender: news@monu6.cc.monash.edu.au (Usenet system)
Organization: Monash University, Melb., Australia.
References: <C01pBA.I4J@ccu.umanitoba.ca> <lu16104@pro-storm.cts.com>
Date: Fri, 1 Jan 1993 04:39:12 GMT
Lines: 44