Solved

batch file question

Posted on 2004-10-05
16
216 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

730 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