How to insert Ctrl + c into a batch file

Discussion in 'Programming & Software Development' started by Zzapped, Jan 24, 2004.

  1. Zzapped

    Zzapped Member

    Joined:
    Jul 8, 2001
    Messages:
    12,352
    Location:
    Madora Bay
    How do I do this, I cant remember ......
    I want to insert the ctrl+c combination into a batch file so it will stop a process from running..........any suggestions
     
  2. hypersonic6

    hypersonic6 Member

    Joined:
    Jun 3, 2002
    Messages:
    316
    Location:
    listening to ASoT
    i don't think you can can you?
     
  3. OP
    OP
    Zzapped

    Zzapped Member

    Joined:
    Jul 8, 2001
    Messages:
    12,352
    Location:
    Madora Bay
    I hope so
     
  4. Jokesta

    Jokesta Member

    Joined:
    May 26, 2002
    Messages:
    320
    Location:
    Brisbane
    As far as I know the Ctrl-C (Break) command is part of DOS. What you can do to get rid of a process running in a batch file is to add the command rem in front of the command (eg rem "copy manual.doc d:\rtfm\"). This will tell the batch file to skip that line while running.
     
  5. sbobz

    sbobz Member

    Joined:
    Jul 6, 2001
    Messages:
    332
    Location:
    Bendigo, VIC
    what exactly are you trying to do? just stop the batch from executing upon a condition? or kill a process?
     
  6. Iceman

    Iceman Member

    Joined:
    Jun 27, 2001
    Messages:
    6,647
    Location:
    Brisbane (nth), Australia
    You can't embed a ctrl-c in the batch file, if you simply want to terminate at a point have an :END label at the end of the batch file and 'goto end' or better yet just insert the command 'break'
     
  7. phoen8x

    phoen8x Member

    Joined:
    Oct 2, 2003
    Messages:
    1,180
    Location:
    Land of OZ
    yes, break is the command you are after. or you can use pause to prompt ppl to press any key to continue or hit ctrl+c. Pause is a bit interactive. break is hard break out no choice here.
     

Share This Page

Advertisement: