Hi guys,
i hope you can help me with that:
I try to pipe some lines into a new batch file.
There are some characters which i can't pipe directly:
For example ">" - I found out already, I have write "^>" to pipe it into a new batch.
But I got some variables aswell, which i want write into the batchfile.
----
Example:
echo here is some text; %CLASSPATH% >>newBatch.bat
so when I open the created batchfile, there is only:
"here is some text; "
----
I have found some different stuff so far, but i does not work or I am doing it the wrong way.
Can you help me?
Thanks so far!
3dL
Pipe variables into a new batch
Moderator: DosItHelp
Re: Pipe variables into a new batch
Apparently the variable CLASSPATH is empty or it contains illegal characters.3dL wrote:But I got some variables aswell, which i want write into the batchfile.
echo here is some text; %CLASSPATH% >>newBatch.bat
so when I open the created batchfile, there is only:
"here is some text; "
if you want to echo a variable that contain illegal characters you can protect it using delayedExpansion, example:
Code: Select all
setlocal enableDelayedExpansion
echo here is some text; !CLASSPATH!>>newBatch.bat
Code: Select all
echo here is some text; %%CLASSPATH%%>>newBatch.bat
Re: Pipe variables into a new batch
Thanks!
Thats what I found out later aswell
it works fine with double %% - so %%CLASSPATH%%
Thats what I found out later aswell
it works fine with double %% - so %%CLASSPATH%%