Home / Microsoft / Microsoft DOS / %~n1 question
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: %~n1 question  (Read 2346 times)
fmgazette
Guest
« on: May 24, 2006, 03:59:48 PM »

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.
IP logged
fmgazette
Guest
« Reply #1 on: May 24, 2006, 04:24:18 PM »

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?
IP logged
fmgazette
Guest
« Reply #2 on: May 24, 2006, 04:44:49 PM »

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.  :-?
IP logged
DosItHelp
Intermediate



Posts: 148




« Reply #3 on: May 24, 2006, 07:56:35 PM »

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?
IP logged
fmgazette
Guest
« Reply #4 on: May 25, 2006, 09:34:45 AM »

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
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / %~n1 question « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.104 seconds with 20 queries.