Solved

A problem with redirect on Windows command line

Posted on 2007-03-29
6
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

738 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