Solved

batch file question

Posted on 2004-10-05
16
206 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This video teaches viewers about errors in exception handling.

803 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