Two Laptop Bag*
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
Author

Command line arguments within registry

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

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 somefile.aaa 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 somefile.aaa, select Doit, and get somefile.aaa.bbb. 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: http://aspose.com/file-tools
 
subject: Command line arguments within registry
 
Similar Threads
Creating Registry Entry for my java program
problem with exit on close operation
Setting the classpath
"Executables" Win2000 - a solution
Area covered by a closed path