Member Avatar for emarcel

Hi Guys,
I've got a small issue passing the string from command line parameter into the variable within the script.
An issue is when the parameter contains an equal mark in the string that brakes the line and the everything after an equal mark is missing. See an example:

script.bat

username=%1
password=%2

echo %username%
echo %password%

::END_SCRIPT

When I run the script as follow:

c:\script.bat John mypass&*(+=word&*
John
mypass&*(+

As you can observe everything after "=" mark has been skipped and variable %password% returns only part of the string mypass&*(+ and word&* is missing.

My question is whether can it be fixed some how and pass the string containing "=" mark from parameter into variable within the script?

Any help, feedback would be appreciated.
Cheers!!
emarcel.

use double quotes to pass the values. But take care that quotes would also be taken as part of value

Member Avatar for emarcel

Thanks! it works now:)

Cheers!!
emarcel

Thanks! it works now:)

Cheers!!
emarcel

Welcome sir!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.