home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / ibm / pc / misc / 16264 < prev    next >
Encoding:
Text File  |  1993-01-01  |  2.5 KB  |  56 lines

  1. Newsgroups: comp.sys.ibm.pc.misc
  2. Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!daneel.rdt.monash.edu.au!tooraj
  3. From: tooraj@daneel.rdt.monash.edu.au (Tooraj Enayati)
  4. Subject: Re: DISABLING CTRL-C in BAT FILES...
  5. Message-ID: <tooraj.725863152@daneel.rdt.monash.edu.au>
  6. Sender: news@monu6.cc.monash.edu.au (Usenet system)
  7. Organization: Monash University, Melb., Australia.
  8. References: <C01pBA.I4J@ccu.umanitoba.ca> <lu16104@pro-storm.cts.com>
  9. Date: Fri, 1 Jan 1993 04:39:12 GMT
  10. Lines: 44
  11.  
  12. brogers@pro-storm.cts.com (Brian Rogers) writes:
  13.  
  14. >In <C01pBA.I4J@ccu.umanitoba.ca>
  15. >ummalik@ccu.umanitoba.ca (Ijaz Rashid Malik) writes:
  16. >>
  17. >>Does anyone know of ANY way that would disable Ctrl-C &/or Ctrl-Break in
  18. >>a BAT file. I have to shell to dos from a database app. (Paradox) to run
  19. >>a BAT file and if user hits Ctrl-C during BAT file processing, every thing
  20. >>gets ruined. I have to catch it somehow...
  21.  
  22. >It's been my experience that there's no real way to disable the Ctrl-C
  23. >checking during a batch file -- HOWEVER, adding "BREAK=OFF" to your
  24. >config.sys AND not doing any input or output from the batch file (eg: with
  25. >the PAUSE command) will pretty much make sure that the batch file is not
  26. >interrupted.  Still, this does not make sure that executables (eg: MORE.COM,
  27. >ASSIGN.EXE, and utilities) run without being interupted by Ctrl-C.
  28. >If you have to use commands such as COPY or others that produce output,
  29. >redirect their output to nul (eg: COPY COMMAND.COM D:\ > NUL).
  30.  
  31. >Hope this helps.
  32.  
  33. >------- Brian Rogers -------+-------------- The Angel of Java ----------------
  34. > "Staying Sane is Hard....  | Internet: brogers@pro-storm.cts.com          
  35. >  Drinking Coffee is Easy!" |   Bitnet: brogers%pro-storm.cts.com@nosc.mil
  36. >----------------------------+-------------------------------------------------
  37.  
  38. I can think of a way to do this, by writing a program (say in C) that
  39. takes the batch file name from the command line and then redirects 
  40. CTRL C to nothing (see Turbo C's help on signal() ) and the makes a 
  41. call to system("batch_file_name.bat").
  42.  
  43. If you want I can send you the source code. All you need to do is to be
  44. able to call the bach file with something like this:
  45.  
  46. ms-dos_prompt> c_program batchfile.bat
  47.  
  48.  
  49. Hope it helps.
  50.  
  51. -- 
  52. ==============================================================================
  53. Tooraj Enayati     Melbourne     Australia     tooraj@daneel.rdt.monash.edu.au
  54. Monash University       Robotic and Digital Technology       (Graduate/Alumni)
  55. ==============================================================================
  56.