carriage return in environment variable?

  • Thread starter Thread starter Nunayadam Bidnez
  • Start date Start date
N

Nunayadam Bidnez

Here's an interesting one I've been wrestling with for a bit now and
figured it was time to post in a ng

using wmic get /value in a for/do command to set environment variables
results in the resultant environment variables. This causes me to not be
able to use the variables in scripts because when i echo the variable
any variables that have only the carriage return (and no other
characters) results in ECHO is on and thusly the breakage in scripts.

Is there some method of modifier in doing set such that carriage returns
are not passed to variables. I have never seen this before and am about
ready to give up

thanks in advance
 
Nunayadam Bidnez said:
Here's an interesting one I've been wrestling with for a bit now and
figured it was time to post in a ng

using wmic get /value in a for/do command to set environment variables
results in the resultant environment variables. This causes me to not be
able to use the variables in scripts because when i echo the variable
any variables that have only the carriage return (and no other
characters) results in ECHO is on and thusly the breakage in scripts.

Is there some method of modifier in doing set such that carriage returns
are not passed to variables. I have never seen this before and am about
ready to give up

thanks in advance

Set can't handle multiline values, but the effect occurs with empte vars.

Simply put a different valid delimiter than a space after the echo.
AFAIK valid delimiters are .:,;/\(+=

set "emptyvar="
echo:%emptyvar%

HTH
 
Back
Top