Page 1 of 1

Using command from clipboard in batch file

Posted: 09 Jul 2010 05:09
by Ed4571
Hi,

I am afraid I may well be missing the obvious here, but here goes:
I have created a webpage which I intend to use purely for me, and from my local directory, and this webpage uses forms to create a dos command, which is then copied to the clipboard. I wondered if it is possible to write a batch file which would take the contents of the clipboard and use it as a command. Any suggestions?

Ed

Re: Using command from clipboard in batch file

Posted: 09 Jul 2010 10:12
by aGerman
On Vista/Win7 is a tool named clip.exe which is able to copy something to the clipboard. But afaik there is no option to paste from clipboard.

Maybe the SendKeys Method of VBScript could be a possibility for you to emulate Ctrl + V.

Regards
aGerman

Re: Using command from clipboard in batch file

Posted: 09 Jul 2010 14:53
by Ed4571
Thanks for answering,
how would it be possible to execute commands in the command prompt using VB?

Re: Using command from clipboard in batch file

Posted: 10 Jul 2010 05:50
by aGerman
Well, the example on the URL link shows how to do.
<obj>.Run "cmd.exe" can open a command prompt
<obj>.SendKeys "what ever" will emulate the keyboard
The only thing you have to know is that [Ctrl] + [V] doesn't work for a command prompt. You would need [Alt] + [Space], [E], [P].

Regards
aGerman

Re: Using command from clipboard in batch file

Posted: 10 Jul 2010 23:10
by !k
Ed4571 wrote:take the contents of the clipboard
Use getClip from http://vb.mvps.org/tools/ConClip/