2

Given a very long single command at the command line in Windows, I'd like to simply copy that command into clipboard.

I am just looking for the ubiquitous Shift-End , Ctrl-C type functionality almost all editors have.

I DON'T want to use Mark (yes, even in QuickEdit mode), which requires me to select the block, paste it somewhere, and remove the carriage returns manually.
Granted, this isn't that hard, but I have a (reasonable) scenario where I am doing this quite a bit and it becomes a hassle.

Cygwin is also not an option, since it does a few things differently, which won't work for my scenario.

Edit, Chosen Answer:
I went with a combination of romandas' and crchad's answers, I am now using the "Console" program for multiple tabs and romandas' suggestion of the "clip" program totally improved the flow:

  • Type out my lengthy command and run it
  • Hit up for previous command and add |clip to the end
  • Hit Home, add echo to the beginning

MUCH Faster than the block editing I was doing before. Thanks!

4 Answers4

14

Not sure there is an answer to this when using a mouse. If you wanted a command-line way to do it, you can just echo the command and pipe that output to clip:

echo stuff you wanted copied to the clipboard | clip

FYI, clip is available on Windows 2003. I believe it is a built-in.

romandas
  • 3,242
  • 8
  • 37
  • 44
2

I can recommend Console. It copies multiple lines more sanely.

FYI: I find the default mouse button options are different from cmd, so you may wish to change them.

Chris
  • 945
  • 7
  • 17
1

Take Command is an alternative command line that does support keyboard copy and paste. Your going to have issues using ctl-c as copy though, as that is usually the command to stop a process.

Sam Cogan
  • 38,158
  • 6
  • 77
  • 113
  • This is pay software, and the answers above got me what I needed, but Take Command does look very capable! I'll have to check out their evaluation copy, thanks for the tip on this. – Kevin Radcliffe Aug 05 '09 at 20:45
  • re: control-C - Ctrl-Ins & Shift-Ins also work for copy and paste. can't remember if it works from CMD.EXE but it certainly works in every windows dialog box input field i've ever tried it on. – cas Aug 05 '09 at 21:02
0

Use QuickEdit mode and Hit "Enter" to copy.

Edit: Whoops I missed that you don't want to use QuickEdit and select with the mouse, etc... One way to do this is use the "set" command to give each of your command strings a variable. Example:

set cmd1=somecommand /switch /anotherswitch

To use it just type %cmd1%

August
  • 3,114
  • 15
  • 17
  • I didn't mention above, but the command I must use varies quite a bit. Your answer is a good reminder though to try to refactor to variables where possible, thanks. – Kevin Radcliffe Aug 05 '09 at 20:46