Solved

A problem with redirect on Windows command line

Posted on 2007-03-29
6
331 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

813 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