Get JAVA system.out.println in bat?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Get JAVA system.out.println in bat?

#16 Post by ShadowThief » 23 Feb 2015 04:28

You're confusing %G% with %%G. They are totally different variables.
Also, the echo before the set means that the %myvariable% variable doesn't actually get set. You can either remove the echo from that line or just call %%G by itself.

Like this:

Code: Select all

@echo off
set CLASSPATH=decoder.jar
FOR /F "delims=" %%G in ('java decode.decoder "dGhpc0lzTXlQVw=="') DO
{
   echo %%G
}


Or this:

Code: Select all

@echo off
setlocal enabledelayedexpansion
set CLASSPATH=decoder.jar
FOR /F "delims=" %%G in ('java decode.decoder "dGhpc0lzTXlQVw=="') DO
{
   set myvariable=%%G
   echo !myvariable!
}

mm@muellermario.de
Posts: 12
Joined: 20 Feb 2015 08:24

Re: Get JAVA system.out.println in bat?

#17 Post by mm@muellermario.de » 23 Feb 2015 05:00

Hi ShadowThief,

Problem solved.
You are my hero!

Many, many thanks!
Regards
Mario

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Get JAVA system.out.println in bat?

#18 Post by foxidrive » 23 Feb 2015 05:54

There were still flaws with the parentheses used and the placement of the opening parenthesis.

Code: Select all

@echo off
set CLASSPATH=decoder.jar
FOR /F "delims=" %%G in ('java decode.decoder "dGhpc0lzTXlQVw=="') DO (
   echo %%G
)
pause


Test this:

Post Reply