Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to capture the contents of the clipboard using the command line?

31 Aug 2013   #1
xenphor

Windows 7 64bit Professional
 
 
How to capture the contents of the clipboard using the command line?

There are lots of sites discussing how to redirect the output of the command line to the clipboard but nothing covering the opposite. I want to capture a link address I have copied to my clipboard and send it to a command line program, as a variable, in a script. Clip.exe seems to be the only command to deal with the clipboard but it only works the opposite way.

If comparing to Linux I'm looking for the command identical to "clipboard=$(xclip -out)"


My System SpecsSystem Spec
.
31 Aug 2013   #2
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

My System SpecsSystem Spec
31 Aug 2013   #3
MilesAhead

Windows 7 32 bit
 
 

Also AutoHotkey has a built in clipboard variable named Clipboard.
To assign clipboard text contents to a variable
MyText := Clipboard

see Clipboard in the help. I recommend AutoHotkey_L variant as it has object/true array support.
My System SpecsSystem Spec
.

31 Aug 2013   #4
xenphor

Windows 7 64bit Professional
 
 

Hm I'll see what I can do, thanks, although I was hoping for a native solution :/
My System SpecsSystem Spec
31 Aug 2013   #5
MilesAhead

Windows 7 32 bit
 
 

Quote   Quote: Originally Posted by xenphor View Post
Hm I'll see what I can do, thanks, although I was hoping for a native solution :/
I suppose you could consider VBScript more "native" than AutoIt or AHK. There's probably a way to do it with VBS I would think. I just don't use it often. But I'm sure you can find sites with VBS code snippets.

edit: another alternative is PowerShell. But I use that even less. I'm not well versed in it.
My System SpecsSystem Spec
31 Aug 2013   #6
xenphor

Windows 7 64bit Professional
 
 

Unfortunately all I know how to do is combine a few command line programs together in a script.
My System SpecsSystem Spec
03 Sep 2013   #7
MilesAhead

Windows 7 32 bit
 
 

I would take a look on boards like softpedia.com and sourceforge.net for free command line clipboard stuff that's more versatile than the MS clip.exe. There's bound to be free ones around.
My System SpecsSystem Spec
Reply

 How to capture the contents of the clipboard using the command line?




Thread Tools




Similar help and support threads
Thread Forum
Command Line - Help
Hi Guy's and Girls, Just first off I've never been too good with CMD and only an Apprentice in my company I work for. Now something I've wanted to do for awhile was to make the following but I don't necassirealy I know how to do this in one batch file: I would need a Batch file that is...
General Discussion
how do i make a shortcut to clear my clipboard contents
i tried following the instructions on this site Create a Shortcut or Hotkey to Clear the Clipboard in Windows - How-To Geek (creating a shortcut with the command cmd /c “echo off | clip”) but it doesnt seem to be working... does anyone know why?
General Discussion
command line to delete folder contents
What line in a batch file would delete the contents of C:\Users\MyName\AppData\Local\Microsoft\Windows\Temporary Internet Files\ ? del /F /S /Q /A "C:\Users\MyName\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*" fails, so does del...
Performance & Maintenance
Script or command to delete contents of Software Distribution folder?
Hi all. Anyone able to suggest a vbs (or command-line file) to clean out C:\Windows\Software Distribution\Download? Thanks, I'm aware of the significance (or lack of) of this folder, and I realize I could just drill down to it and manually dump the contents. I'm just looking for a more elegant...
Windows Updates & Activation
Command Prompt - Copy to Clipboard
How to Enable Copy to Clipboard from Command Prompt in Windows 7 This will show you how to enable or disable Quick Edit mode in the command prompt to highlight text within the command prompt to copy to the clipboard in Windows 7.You can use this for a normal command prompt or elevated...
Tutorials
Command Line
Is there a cmd.exe /switch for “run as administrator” ? Thanks-
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 04:09.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App