Jump to content

Recommended Posts

Posted

How do you assign a commandline variable to environment variables?

using this in a batch file if I don't type anything after mybatch

I'm prompted and what is properly assigned the value. But if I type

"mybatch doit" its not. Or is this not possible?

mybatch

set what = %1
if Not DEFINED what set /P what=?
echo %1
echo %what%

Thanks for any help


Posted

Is This What You Want

Echo Off && CLS && MODE 75,5 && Color f3 && Title Set New Varible

set what =

Echo. && if Not DEFINED what set /P what= %UserName%, Type In The New Varible?-^>

CLS && Color 3F

Echo. && set /P = %UserName%, The Input Enter = %what%, Press Key To Exit

Posted

I want to copy the command line variable to an environment variable

but something like

set myvariable = %1

doesn't work

Posted

actually your only problem was the additional spaces before and after the equals symbol

set what=%1
if Not DEFINED what set /P what=?
echo %1
echo %what%

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...