1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to? Stop a command in the middle of its operation

Discussion in 'Support' started by Avi Shmidman, Feb 23, 2012.

  1. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    In the regular DOS command prompt, I can hit Ctrl-C to stop an operation in its tracks. So, let's say I run a long operation in a loop, iterating over all subdirectories, like this:
    for /d /r %G in ("*") do [command] %G
    with the regular command prompt, I can stop it at any time with Ctrl-C. However, I can't find any way to do so in TCC. To be sure, there is an option to support Ctrl-C in batch files, but that doesn't seem to help here (perhaps because this is not a batch file with multiple lines, but rather a single line command).
    As far as I can tell, the only thing I can do to stop it is to close the TCC window altogether - not a great solution because I lose all my history!
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,300
    Likes Received:
    39
    Control-C works for me. What are you doing that you can't stop?
     
  3. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    Well, I'm running a custom utility that I wrote, but I can reproduce the problem with the simple "dir" command. Go to your root directory and run:
    dir /s
    This will recurse through all directories, outputting all files. On my system, with nearly a million files, this takes a bit of time, even in TCC. I would expect, however, to be able to stop it with Ctrl-C. However, Ctrl-C does not work for me.
    Similarly, if we do the same thing in a for loop on the command line, like this:
    for /d /r %G in ("*") do dir %G
    Here too, Ctrl-C does not affect it
     
  4. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    OK, I found the problem. When I first installed TCC, I wanted to copy and paste text as I was used to, and it seems strange that I could not do it with Ctrl-C, so I set Ctrl-C to be "copy" in my keyboard shortcuts. But it seems that in doing so, I canceled my ability to break within a program!
    Thanks anyway for your help.
     
  5. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,300
    Likes Received:
    39
    DIR /S is what I tried, and Control-C definitely interrupts it here.

    Is this in a Take Command tab, or in a standalone TCC console? If you're having the issue in a Take Command tab, you might go to Options / Configure Take Command... / Tabs, and check that the tick boxes marked 'Left Ctrl Key' and 'Right Ctrl Key' are both turned off.
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,300
    Likes Received:
    39
    Aha; that makes sense! I'd forgotten there was such an option.
     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    The problem is that you want to overload Ctrl-C to mean two different things. You can actually do that with Take Command by specifying one Ctrl key (left or right) that will be handled by Take Command; the other one will be passed to the current tab window. So for example, a (left)Ctrl-C can copy, and a (right)Ctrl-C can interrupt.
     

Share This Page