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

Command line arguments within registry

Peter Johnson

Joined: May 14, 2008
Posts: 5852

I have an app that read a file and generates another file based on it. Basically, the syntax is like this:

Now, I'm lazy. Rather than opening a command prompt and typing the above, I would rather just right-clik on the file in Explorer and choose the Doit option and have the file converted. (Yes, I could write a batch file to reduce the typing, but I don't want to have to type at all. Like said, I'm lazy. I'm also a horrible typist; anyone following my posts can attest to that fact!)

So I go into the registry and add the Doit right-click menu item and use this in the default command:

This almost works. I right click on, select Doit, and get The extension is correct, but the name isn't exactly what I want. I really want somefile.bbb. I know that within a script you can use the notation %~n1 to get the name of the file without the extension, but that notation doesn't work from a registry command - the resulting file is named %~n1.bbb. Also not what I want.

Does anyone know how I can accomplish my goal? (I can think of a few workarounds, such as move the doit command into a batch file and call the batch from the registry, but the workarounds are all somewhat ugly. I would prefer something that can be done entirely within the command string within the registry.)

JBoss In Action
I agree. Here's the link:
subject: Command line arguments within registry
It's not a secret anymore!