Re: Re: How to read value of a variable being set in a batch file?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You will be the one, I presume, favoring a "commercial" to a website
in plain Schulman text, reposting question to the
end of a question, thereby having the reader in limbo tho the essence.


-------------------------------------


With your a so value to this group, your tips are far from vital nor
essential.



"Jerold Schulman" <Jerry@xxxxxxxxxx> wrote in message
news:ctccj2l8151qr5amjpebe6cqfr30oni9u0@xxxxxxxxxx
On 18 Oct 2006 06:39:02 -0700, stembe@xxxxxxxxx wrote:

Thanks everyone for their suggestions so far....From what I can tell, I
have 3 options:

1). Write the value to a temp file & then read the temp file (and
delete it) - Doable, but seems inefficient to me.

2). Read value of the environment variable - This will only work if I
set VAR1 as a permanent system variable along with PATH, TEMP, etc.;
and as Tom has mentioned setting VAR1 in the batch script will not work
since it will not be "exported" to the parent process.

3). Echo the variable in my batch script & then use StdOut.Readall to
read it into a string -- This works, but I noticed that the string
contains trailing special characters and I can't seem to figure out
what they are. They look like spaces or blanks, but are not, because
when I try to strip off spaces from the string, it does not work (the
"length" of the string stays the same, even though the actual number of
characters displayed or visible is less). Not sure if they are tabs or
something else.

Is there a way to find out & strip off any special characters from a
string in my scenario?

Thanks,
S
See tip 10922 » How can a Vbscript process each line in the STDOUT
generated from a CMD command or batch?
in the 'Tips & Tricks' at http://www.jsifaq.com to read each line
individually.



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com

.



Relevant Pages

  • Re: test for "special characters" in text
    ... >I need to make sure that a cell contains NO SPECIAL CHARACTERS (including ... Function foo(s As String, ... own invalid entries that caused the errors. ...
    (microsoft.public.excel.worksheet.functions)
  • [PATCH 2/2] tracing/filters: support for operator reserved characters in strings
    ... Because the operators and parentheses have a higher precedence ... than the operand characters, which is normal, then we can't ... Then after this patch you can still declare string condition like ... support strings with special characters for tracing filters] ...
    (Linux-Kernel)
  • Re: How to "quote" all regexp expression special characters?
    ... the regular expression to use, but such that any regular expression ... special characters are "quoted" to be treated as regular characters. ... What operator or function that takes a string will return the original ... not to quote the "$search4" value. ...
    (comp.lang.perl.misc)
  • Re: special characters treated as text (not trivial I think)
    ... of special characters to a list, ... proc x {nick uhost hand chan text} { ... I think that the error arrising earlier is given of the [string] ...
    (comp.lang.tcl)
  • Re: Opposite of split
    ... You don't need to separate out special characters (TABs, NEWLINEs, etc.) in a string. ...
    (comp.lang.python)