Run Files with a Sham Extension via Batch Script


By: Majid Pasha
April 16, 2011

Hi Everyone

Today I want to learn you "How-To" run files with a sham extension via batch script, for example you can change a text file extension to whatever you want, then run it properly!

Note: The good point of this way is that the new extension won't be changed at all. for example if you change .txt to .mpf , after running this code the extension will be .mpf without changing and you have your text file ran.

Now Think you have Me.txt, now you change its extension to mjk, then you have Me.mjk that won't be run at all. Here is the code to run such files:

assoc.ext=winfile
Start "" "Path\File.ext"
assoc.ext=extfile

Note: Do not change the format of this code, it should be like this.
Note: Replace "ext" with your own extension of your file, for example mpf. It can be more than 3 digits too.
Note: Replace "win" with a know extension in windows. for example txt or exe or cmd etc.

Example:
I have a text file which is located in C:\Info\, the filename is Majid.txt, Now I want to change its extension to mpf (majid pasha faghani), then I have Majid.mpf, Now I can not run it :( So I should try my code in scripts :)

assoc.mpf=txtfile
Start "" "C:\Info\Majid.mpf"
assoc.mpf=mpffile

Now I can run my text file without changing its extension to .txt again. and as I told it before in Note1 it is the good point of this way or trick.

Thanks for reading this "How-To"
______________
Special Regards
Majid Pasha


Need more help?
Describe your Problem
Example: Hard Drive Not Detected on My PC

Ask Question