command line variables

Posted on 2014-08-30
Medium Priority
Last Modified: 2014-08-31
Can you somehow set a variable to a string you hold in your clipboard? For example there is 'abc' in clipboard and you want a='abc'.
Question by:axcx
1 Comment
LVL 71

Accepted Solution

Qlemo earned 2000 total points
ID: 40294954
Not natively, you always need some code written in a different language, sometimes with some detours. You can find tools written in VBS, PowerShell, Pascal, Perl and many more all over the internet, I cannot recommend any particular, but here is an example using PowerShell:
for /F "tokens=*" %%A in ('PowerShell -NoProfile -STA -Command "& { Add-Type -Assembly PresentationCore;   [Windows.Clipboard]::GetText() }"') do set a=%%A

Open in new window

inside of a batch file. If you want to execute that on the command prompt, replace %%A by %A twice.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question