Solved

batch file question

Posted on 2004-10-05
16
184 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
Comment Utility
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
Comment Utility

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

0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Possibly just a directory parameter to the java program
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
> 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
Comment Utility
>>it is passed as an argument to the java application ...

Already mentioned
0
 
LVL 92

Expert Comment

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

0
 

Author Comment

by:dkim18
Comment Utility
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
Comment Utility
> 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:dkim18
Comment Utility
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
Comment Utility
it creating a string containing a file path to the directory Scans_for_header_ext.
0
 

Author Comment

by:dkim18
Comment Utility
does "scans\" do anything special?
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
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
Comment Utility
> 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
Comment Utility
thank you so much!
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
no worries bud :)
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
8-)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

744 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

18 Experts available now in Live!

Get 1:1 Help Now