Welcome to MSDN Blogs Sign in | Join | Help

Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Repro:

·        Use RunAs or MakeMeAdmin to get a CMD shell running in a different security context.

·        Run “DIR /A /S C:\” to list every file and folder on the C: drive. 

·        Try to stop the output with Ctrl-C. 

 

Result: 

Nothing happens.  “DIR” continues to execute.

 

Workaround: 

Use Ctrl-Break instead.

 

[Added, March 9, 2005:

While this problem occurs on Windows XP, it does not occur on Server 2003 RTM!

]

Published Wednesday, February 09, 2005 11:58 PM by Aaron Margosis
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Thursday, February 10, 2005 4:22 AM by Centaur
Oh yes… Stepped on that. Most annoying when a program such as ping or wget has alternate semantics on Ctrl+Break.

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Thursday, February 10, 2005 7:59 AM by David Wright
I recently discovered this also whilst doing a ping -t. The problem there is CTRL-BREAK doesn't break out of the ping but just shows the ping stats. Haven't worked out how to sort that one yet.

# More Tips and Tricks for the LUA User

Tuesday, February 15, 2005 12:19 AM by strawberryJAMM's Security and User Experience WebL
Aaron Margosis has posted four more columns with LUA Tips and Tricks on his

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Wednesday, February 16, 2005 6:37 PM by Adam
This was something I bugged with Microsoft a long time ago. Nice that it is still around.

# More Great Non-Admin Resources

Tuesday, March 01, 2005 10:23 PM by Geek Noise

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Thursday, March 03, 2005 6:50 AM by call doctor
reboot as 14997987. enter in to runas

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Thursday, March 03, 2005 8:02 AM by Aaron Margosis
"call doctor", what does your comment mean?

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Monday, March 07, 2005 1:12 PM by Numy
If anyone happens to discover the cure for CTRL-C or CTRL-BREAK when doing a ping -t that would be great. Obviously closing the window is an option but for some of us "effcient" folk it would be nice to keep that window.

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Monday, March 07, 2005 2:44 PM by Aaron Margosis
Yeah, I'm trying to find out. What I do is to kill the "ping.exe" process through Task Manager / Process Explorer.

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Monday, March 07, 2005 3:39 PM by Numy
Hah, nice one. That makes way too much sense.

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Monday, March 07, 2005 11:38 PM by Aaron Margosis
Found the reason for Ctrl-Break doing what it does - it is by design. See KB article 325487 ("How to troubleshoot network connectivity problems"), http://support.microsoft.com/?id=325487 quoted here:
"To watch Ping statistics, use the ping -t command. To see statistics and continue, press CTRL+BREAK. To stop, press CTRL+C."

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Tuesday, March 08, 2005 8:59 AM by Numy
Nice find. So it looks like a kill of ping is about the only route given our inability to use CTRL-C through an RunAs Shell. Interesting problem though... Still makes me want to understand why CTRL-C doesn't respond.

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Wednesday, March 09, 2005 10:35 PM by Aaron Margosis
Couple of quick comments:
1. I just added a note that this is not a problem in Server, only in XP.
2. Another workaround for the "ping -t" problem is that you don't need runas to run "ping -t" -- you can run it as the originally logged-on-user. Normal users can send ICMP packets just like admins!
HTH

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Thursday, March 10, 2005 12:28 PM by Numy
Good confirmation re: XP

That's a valid point re: non-admin ping. I'll just have to start a little shock treatment to alter my behavior. ;)

Thanks for the follow up!

# Tools 2 Use - Do You LUA?

Sunday, April 10, 2005 12:58 PM by tonyso
If you have not read Jen's article on LUA, you should be asking yourself why not?

This article...

# Table of contents, Aaron Margosis' non-admin blog

Monday, April 18, 2005 8:22 PM by Aaron Margosis' WebLog
Complete list of Aaron Margosis' non-admin / least privilege posts, for easy lookup.

# Spread the LUA joy

Friday, June 10, 2005 12:12 PM by tonyso
Get your friends and family, all those folks that come to you for computer help once their machines have...

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Tuesday, June 28, 2005 8:51 AM by Leviathan
Find a solution...

Just Press CTRL+Shift+C for having a C instead of a c

CTRL+c --> don't work if capslock not engage

CTRL+C --> work

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Tuesday, June 28, 2005 2:36 PM by Aaron Margosis
Leviathan, did you actually try that "solution" before you posted it? It doesn't work.

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Thursday, June 30, 2005 11:19 AM by Ross Presser
Another choice is to run a different ping utility, like the one from <a href="http://www.cygwin.com">Cygwin</a>, or the excellent <a href="http://www.d3tr.de/">3d Traceroute</a>. I suppose I should wash my mouth out with soap now though, for suggesting a non-Microsoft, non-MSI, non-digitally-signed bit of software? *grin*

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Thursday, June 30, 2005 11:20 AM by Ross Presser
Sigh .. didn't realize HTML was verboten.
Cygwin: http://www.cygwin.com
3d Traceroute: http://www.d3tr.de/

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Friday, November 25, 2005 5:41 PM by Gina
I cant get that one to work either

# re: Ctrl-C doesn't work in RUNAS or MakeMeAdmin command shells

Thursday, December 04, 2008 9:28 AM by sba

Now I hit an entirely different issue: my Dell laptop has NO Pause/Attn key, so I can't break scripts running in a RUNAS'ed shell AT ALL...

Any idea?

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker