1

Is there any way to redirect a command output to clipboard in WinDbg similar to

<command> | clip
balajimc55
  • 2,192
  • 2
  • 13
  • 15

1 Answers1

6

On Windows 10, clip is a built-in Windows command line executable to copy text into the clipboard. On other versions of Windows you might need to find a similar tool and install it somewhere in %PATH%.

You can use it from WinDbg with

.shell -ci "<command>" clip

e.g.

.shell -ci "k" clip

to copy the call stack to the clipboard.

There's also the undocumented !! abbreviation of .shell, so you can do

 !! -ci "k" clip

If you use a WinDbg startup script anyway, you can define an alias, e.g.

as | .shell -ci

and then do a very short

| "k" clip

Note that this redefines |, which shows the current process. I use that command at least once in every debugging session, so I don't recommend that. Maybe you find a better shortcut.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222