Jump to content

Editing filetype - impossible to pass just the filename?


Recommended Posts

When adding new filetype to Windows, there it is possible to define the operations with it. I choose usually the "open" operation and choose just the executable it should use and that it is. Fairly simple, huh?

Windows itself add after the full path of the executable file the "%1" variable, witch should pass the full path and filename of the file user clicked on. So far, so good. However a nightmare begin, when this don't work and the application refuse to accept anything EXCEPT the filename. Then it looks like it is IMPOSSIBLE to setup in Windows, because no-one of the variables listed that I found seems to pass the much desired filename only:

%* - replace with all parameters

%~ - replace with all parmaters starting with and following the second parameter

%0 or %1 the first file parameter. For example “C:\Users\Eric\Destop\New Text Document.txt”.

%<n> (where N is 2 - 9), replace with the nth parameter

%s – show command

%h – hotkey value

%i – IDList stored in a shared memory handle is passed here.

%l – long file name form of the first parameter for win32 apps, win16 get short file name. Specifying %L is preferred.

%d – desktop absolute parsing name of the first parameter (for items that don’t have file system paths) (this won't work either)

%v – for verbs that are none implies all, if there is no parameter passed this is the working directory

%w – the working directory

http://superuser.com/questions/136838/what-is-the-list-of-special-variables-available-when-writing-a-shell-command-for

http://networkadminkb.com/KB/a192/how-to-determine-possible-context-menu-parameters-class.aspx

I was not managed to find anything usefull. The app in qestion is eDuke32... When starting demo as by shel command: eduke32 -nologo -Ddemo8.dmo

...then everything works just fine. God forbid you expect this works as when you click on the file in windows... :(

Or can it be done?

PS. looked there: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true

...and find things like "%~n1 - Expands %1 to a file name." or "%~nx1" - Expands %1 to a file name and extension." ...however neither "%~n1", "%~nx1", "%1%~n1" or "%1%~nx1" works... That suxx.

Edited by caps_buster
Link to comment
Share on other sites


You can add one or more parameter to the file association command, see:

http://www.la-solutions.co.uk/content/fileassociations.htm

http://www.vbaccelerator.com/home/VB/Code/Libraries/Shell_Projects/Registering_File_Associations/article.asp

If this command works for you in a command line:

eduke32 -nologo -Ddemo8.dmo

and you make an association to (say) file type .dmo, you will have in it something like:

"C:\whatever_path\eduke32" -nologo -D"%1"

or

"C:\whatever_path\eduke32" -nologo -D%1

or

"C:\whatever_path\eduke32" -nologo "-D%1"

If it doesn't work, you can use an indirect way, by using cmd.exe (but you will have an open "cmd window") or Nirsoft nicmd.exe (that can be run in "hidden mode") and have them call the eduke32 as if it was done on command line.

http://www.nirsoft.net/utils/nircmd.html

jaclaz

Link to comment
Share on other sites

Yep, as you quessed it, neither of the suggested works :(

Using shell it always works, but never using normal windows explorer. And that is the desired effect. Click on demo and make it PLAY. Nothing else. Using shell is kinda... ehm... errr... NO. I did not want to go there. Things should work by clicking and not by typing things, especially when we are supposedly in windows!

Oh, well. Sorry, I looking only for a way to make things work easily, not hard way... :(

Link to comment
Share on other sites

Look, the general idea is to solve issue (if possible), not to solve them AND solve them in the way you thing "nice" or "easy" or simply "fancy".

This may be "hard" :unsure: , but works:

Dukem.cmd

@eduke32.exe -nologo -D%~nx1

In file association, "open" command:

"nircmd.exe" exec hide Dukem.cmd "%1"

jaclaz

Link to comment
Share on other sites

Well, the nircmd.exe have only 40k, so adding these two small files in the system32 win dir is a good price to pay for easy access to any demo of choice! And it works just great! Purrfect, thanks a lot, mate! :thumbup It is maybe not the most cleanest solution, but sure as hell it WORKS :yes:

Thank you very much, you are a good inspiration for all!

...now what two files to delete in system32 dir to make it even... :ph34r:

Link to comment
Share on other sites

LOL... thanks anyway. Your spoiler is funny. Somehow I did not believe someone could sustain so much injuries for one simple fall :) But looks like we never know :D After all, the wordings "conspiration theoretic" are suggested to be used by CIA, right after public have hard time to swallow "the magic bullet" theory, where one single bullet can do sever different injuries to two men's ;)

One fell = many injuries.

One bullet = many injuries.

Looks like these guys learned well, how to spin what happend... and who can blame them, true. But it is not the truth, not even a tiny fraction of it :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...