This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
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.)