Solved

batch file question

Posted on 2004-10-05
16
211 Views
Last Modified: 2010-03-31
hi!

I have this batch file, and can someone tell what does these lines do?

@echo off
java extractHeader g:\temp mri for header ext

thanks,
0
Comment
Question by:dkim18
  • 7
  • 5
  • 4
16 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 20 total points
ID: 12231704
1. don't echo output
2. run java class 'extractHeader' passing remainder of line as parameters to the java program
0
 

Author Comment

by:dkim18
ID: 12231804

what does "g:\temp"  do on second line?

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12231908
Possibly just a directory parameter to the java program
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 92

Expert Comment

by:objects
ID: 12232326
> what does "g:\temp"  do on second line?

it is passed as an argument to the java application.
the application will use that value (accessible from args passed to main)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12232343
>>it is passed as an argument to the java application ...

Already mentioned
0
 
LVL 92

Expert Comment

by:objects
ID: 12232385
I'm providinding clarification and more information to help dkim18, why do you have a problem with that?

0
 

Author Comment

by:dkim18
ID: 12233307
Let's not fight too much over points...

I understand it is passed as arguement. I was was wondering there were any relationships among "g:\temp", 'mri', 'for' ,  'header',  'ext', since there were spaces among those. However, I didn't any particular code that treat them as second, or thrid arguement.

Sorry if my question wasn't clear. I thought "g:\temp", does anything special to other args.
0
 
LVL 92

Expert Comment

by:objects
ID: 12233340
> Let's not fight too much over points...

funnily enuf the points don't bother me :)

not sure why cehj has a problem with me trying to help.

> I was was wondering there were any relationships among "g:\temp", 'mri', 'for' ,  'header',  'ext', since there were spaces among those.

they are just seperate args, it depends on how the app deals with them:

args[0]="g:\temp"
args[1]="mri"
args[2]="for"
args[3]="header"
args[4]="ext"
0
 

Author Comment

by:dkim18
ID: 12233437
Now, I found the following code in the main. (I am reading someone else's code that was written a few years ago  and there are a few same files..)

      public static void main(String[] args) throws Exception
      {

      while (true){
            String mappedDrive;

            try
            {      
                  if (args[0] != null)
                        mappedDrive = args[0];
                  else
                        mappedDrive = "E";
            }
            catch (Exception e)
            {
                  mappedDrive = "E";
            }

            UIManager.setLookAndFeel(new MetalLookAndFeel());
            JFileChooser chooser = new JFileChooser();

            if (runOnce == false)
                  startDir = mappedDrive + ":" + System.getProperty("file.separator") + "scans\\Scans_for_header_ext";

            File directory = new File(startDir);

            chooser.setCurrentDirectory(directory);
            chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            int returnVal = chooser.showOpenDialog(null);
            if (returnVal == JFileChooser.APPROVE_OPTION)
            {
                  if (runOnce == false)
                        startDir = getStartPath(chooser.getSelectedFile().getAbsolutePath());
            
                  String fileOutPath = System.getProperty("user.home") + System.getProperty("file.separator") +
                        "Desktop" + System.getProperty("file.separator") + "001.hdr";

                  File outf = new File(getOutPath(chooser.getSelectedFile().getAbsolutePath()));

                  PrintWriter out = new PrintWriter(new FileWriter(outf));
System.out.println(outf);
System.out.println(chooser.getSelectedFile());
                  DicomFile dicom = new DicomFile(chooser.getSelectedFile());

                  Vector ElementNameVector = dicom.getElementNameVector(); // names of catagories
                  Vector ElementValueVector = dicom.getElementValueVector(); // bunch of large numbers
                  Vector ElementDataStringVector = dicom.getElementDataStringVector(); // data

                  Object[] catagories = ElementNameVector.toArray();
                  Object[] data = ElementDataStringVector.toArray();

                  String finalHeader = "(";
            
                  for (int i = 0; i < ElementNameVector.size(); i++)
                  {
                        finalHeader = finalHeader + "(" + catagories[i].toString() + " " + data[i].toString() + ") ";
                  }
            
                  out.print(finalHeader);
                  out.print(")");
                  out.close();
            
            }
            else
                  System.exit(0);

            if (runOnce == false)
                  runOnce = true;
      }
      }
++++++++++++
what does "scans\\Scans_for_header_ext" do for the following line?

startDir = mappedDrive + ":" + System.getProperty("file.separator") + "scans\\Scans_for_header_ext";

(\\ indicates double back slash)

thanks,
-I increased points since I am asking different question


0
 
LVL 92

Accepted Solution

by:
objects earned 130 total points
ID: 12233462
it creating a string containing a file path to the directory Scans_for_header_ext.
0
 

Author Comment

by:dkim18
ID: 12233696
does "scans\" do anything special?
0
 
LVL 92

Expert Comment

by:objects
ID: 12233970
no, thats just a directory name.

eg. if mappedDrive was "E" then startDir would be:

E:\scans\Scans_for_header_ext
0
 
LVL 92

Assisted Solution

by:objects
objects earned 130 total points
ID: 12233976
> startDir = mappedDrive + ":" + System.getProperty("file.separator") + "scans\\Scans_for_header_ext";

you'd get the same effect with:

startDir = mappedDrive + ":/scans/Scans_for_header_ext";
0
 

Author Comment

by:dkim18
ID: 12234023
thank you so much!
0
 
LVL 92

Expert Comment

by:objects
ID: 12234124
no worries bud :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12235631
8-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

808 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