command line variables

Posted on 2014-08-30
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 67

    Accepted Solution

    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    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 …
    Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now