Redirecting Ouput Issue.
Posted: 08 Dec 2011 00:27
Hi Guys,
I need help. I have a bat file (strlen.bat) that will calculate the length of a string.
Example usage 1:
strlen "Hello World"
Output:
11 (The quotes are removed)
strlen ""Hello World"
Output:
12
Now I want to transfer the output to variable I typed in this code in my "sample.bat":
strlen ""Hello World" > tmp
set /p len =< tmp
However instead of redirecting the output to tmp and from tmp to the variable %len% the output goes to the command line. It didn't work as expected because of the extra quote but what if I really want to include it how will I redirect it to a file?
Please me on this.
I need help. I have a bat file (strlen.bat) that will calculate the length of a string.
Example usage 1:
strlen "Hello World"
Output:
11 (The quotes are removed)
strlen ""Hello World"
Output:
12
Now I want to transfer the output to variable I typed in this code in my "sample.bat":
strlen ""Hello World" > tmp
set /p len =< tmp
However instead of redirecting the output to tmp and from tmp to the variable %len% the output goes to the command line. It didn't work as expected because of the extra quote but what if I really want to include it how will I redirect it to a file?
Please me on this.