Solved

A problem with redirect on Windows command line

Posted on 2007-03-29
6
324 Views
Last Modified: 2010-04-16
I'm using CMD under Windows XP to get a command line.  From there, I am issuing a java command with a number of arguments, and trying to redirect the output to a log file.  Problem is (... and I seem to remember something like this many moons ago in my DOS days...) when the command executes, it inserts an additional "1" character before the redirect character ">" and as a result the redirect does not work.

Here's the command in the .BAT file:
  "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -jar ofbiz.jar -install > framework\logs\console.log

.. and here are the results in the cmd window:

C:\>"C:\Program Files\Java\jdk1.5.0_11\bin \java" -Xms256M -Xmx512M -Duser.language=en -jar ofbiz.jar -install  1>framework\logs\console.log

Where is this "1" coming from, and what do I do to avoid it?

Thanks.
0
Comment
Question by:MiltonLClark
  • 3
  • 3
6 Comments
 
LVL 30

Accepted Solution

by:
SteveGTR earned 50 total points
ID: 18817047
One is the desination for standard output. 2 is standard error.

You could do this:

@"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -jar ofbiz.jar -install > framework\logs\console.log

or

@("%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -jar ofbiz.jar -install)> framework\logs\console.log

Good Luck,
Steve
0
 

Author Comment

by:MiltonLClark
ID: 18817476
I tried the first segment you sent, and I got no output at the command line, so not sure if it worked or not.  (Does the "@" turn echo off?).

The second segment, with the "@" once again stopped any further output to the command line window, so I tried it without "@" and got a similar problem/outcome:  
C:\>("C:\Program Files\Java\jdk1.5.0_11\bin\java" -Xms256M -Xmx512M -Duser.language=en -jar ofbiz.jar -install ) 1>framework\logs\console.log

So, to clarify, I want a way to redirect the output to the logfile, but I also need to see output in the command line window to see what is/is-not executing, and correctly or not.

Thanks.
0
 
LVL 30

Assisted Solution

by:SteveGTR
SteveGTR earned 50 total points
ID: 18818386
@ suppresses echo

If you want to see everything then you're going to see the 1. Just know that it mean redirect to standard output. It's the default when you used >.
0
Why spend so long doing email signature updates?

Do you spend loads of your time carrying out email signature updates? Not very interesting are they? Don’t let signature updates get you down. Let Exclaimer Cloud - Signatures for Office 365 make managing email signatures a breeze.

 

Author Comment

by:MiltonLClark
ID: 18819157
Thank you for the info...  Can you point me to a more detailed discussion of redirect under Windows?

Thanks again.
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 18819267
You could really always give out grade of 'A'.

In my opinion the grading system in EE is worthless. To ask a person who knows nothing about the solution other than what you've given them to grade a question that affects the overall points given to the expert is disturbing... At least to me :)

No back to the question:

http://www.robvanderwoude.com/index.html
0
 

Author Comment

by:MiltonLClark
ID: 18819568
Thank you on all counts, Steve.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now