1.

Solve : %~n1 question?

Answer»

I'm trying to set right-click file options in Windows XP. I'm applying a conversion program to CONVERT DGN files to DXF. The command I have is...

"C:\Program Files\FME\fme.exe" GENTRANS IGDS "%1" ACAD "%1".dxf

It works, but it converts "abcd.dgn" to "abcd.dgn.dxf" - whereas I simply want "abcd.dxf"

From what I saw on this site I thought the %~n1 option would get rid of the ".dgn" part, eg "%~n1".dxf - but all I get is an output file called (you guessed it) %~n1.dxf

Am I using the %~n1 option incorrectly, or is there another way to achieve this? Any help appreciated.
Ah - I see the %~n1 option is only valid under the CALL command

Still - do you think it's possible to use CALL in this function, or is there another way of achieving what I need?OK - even if that doesn't work - this should...

cmd.exe /K call "C:\Program Files\FME 2640\fme.exe" GENTRANS IGDS "%1" ACAD "%~pn1".dxf

...since CALL also permits %~pn1 - same problem THOUGH. :-?fmgazette

Try

Code: [Select]cmd.exe /c "for %%A in ("%1") do @(C:\Program Files\FME 2640\fme.exe" GENTRANS IGDS "%%A" ACAD "%%~pnA".dxf)"

DOS IT HELP?Afraid that doesn't work either. I think we're up against the fact that the Windows file options don't properly expand the ~n part - the pieces of code I listed earlier do work when directly entered onto the command line or run from a bat file, just not when Windows sends it from a right-click menu option. Not sure if there is a way around that issue - I guess I need a DIFFERENT method of removing the .dgn part.

Thanks for your help anyway 8-)

MI



Discussion

No Comment Found