neizod
neizod

Reputation: 1577

Double click to run files with own extension on Windows with own program?

Say, I have my files save in my own extension: .example, and I write my own program myprogram to read those files.

Normally, I can run it within cmd like:

cmd> myprogram myfile.example

Now I want my friend to run this file too, but I don't want to go tell my friend "open cmd and type this...", I just want to tell "let me install you a program, then all you have to do is double click these files"

I've try create .bat file, and associate that extension with .bat file, but after I double click on file, I couldn't get filename to run.

Please help.

Upvotes: 2

Views: 752

Answers (1)

npocmaka
npocmaka

Reputation: 57282

From batch file:

assoc .example=examplefile
ftype examplefile=c:\myprogram "%%1" %%*

From console:

assoc .example=examplefile
ftype examplefile=c:\myprogram "%1" %*

Try to run this once as administrator.And to open your file with the corresponding extension.

Upvotes: 2

Related Questions