I'm trying to create a simple alias that calls a program with the parameter(s) passed to it, after massaging them slightly. The first parameter is required, and the second is optional. If the second is not supplied, I want to take the first parameter, use just its filename, and prepend the _cwd. Both parameters must be properly quoted, if needed, and both must be full paths, not relative.
Here is what I created, but it doesn't work if the second isn't supplied, complaining about not being able to find %2 that won't exist. In other words, it's not doing short-circuit evaluation, because it shouldn't need to do the second part of the @if because the conditional evaluates true. How do I change this to work properly?
RichCopy="c:\Program Files (x86)\Microsoft Rich Tools\RichCopy 4.0\RichCopy.exe" %@quote[%@full[%1]] %@if[%# == 1,%@quote[%_cwd\%@filename[%1]],RichCopy %1 %@full[%2]]
Here is what I created, but it doesn't work if the second isn't supplied, complaining about not being able to find %2 that won't exist. In other words, it's not doing short-circuit evaluation, because it shouldn't need to do the second part of the @if because the conditional evaluates true. How do I change this to work properly?
RichCopy="c:\Program Files (x86)\Microsoft Rich Tools\RichCopy 4.0\RichCopy.exe" %@quote[%@full[%1]] %@if[%# == 1,%@quote[%_cwd\%@filename[%1]],RichCopy %1 %@full[%2]]
Last edited: