File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Parse Command file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Parse Command file" Watch "Parse Command file" New topic

Parse Command file

Martinelli Simon

Joined: Mar 20, 2006
Posts: 1
Hi all,

I have a command-file that looks like that:

What I like to do is to parse the file and get back a String with the call of javaw that you see in the last line. All variables sourrounded by % should be subsitutet.

Thanks for your help.

Regards, Simon
Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
What have you tried so far? At what point in the problem are you stuck?

Fun programming etcetera!
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I'm sure it's possible in Java (at least in those versions that allow you to access system environment variables), but Java doesn't sound like the best language for this, as it doesn't know anything about the NT shell. Is there some reason you have to use Java? Could you consider using NT command script, Perl, Python...?

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Some pseudocode:

Have a look at java.util.regex and String.replaceAll.
I agree. Here's the link:
subject: Parse Command file
It's not a secret anymore!