Solved

A problem with redirect on Windows command line

Posted on 2007-03-29
6
318 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

13 Experts available now in Live!

Get 1:1 Help Now