Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Making a file (bat?) to automatically create files associations?

25 Jul 2015   #1
unko

Win7x64
 
 
Making a file (bat?) to automatically create files associations?

Hello, currently if i want to had a file extension to Windows, i have to open the new file type, select the app & tick "always open with" then go to the "Types" app to select correct icon.

This take times, especially if doing it on many computers. So is it possible with a .bat/cmd file to create these extension AND make them display the correct/unbroken icon?


My System SpecsSystem Spec
.
25 Jul 2015   #2
GokAy

Windows 7 Ultimate x64 SP1
 
 

Would something like this accomplish what you want? Edit File Type Association, Actions & Icon From Right-Click Menu
My System SpecsSystem Spec
25 Jul 2015   #3
unko

Win7x64
 
 

... If you read my message (not just the title), you'll see i mention this exact app which i use already. So i look for something else obviously. Thanks for taking time to reply though.
My System SpecsSystem Spec
.

25 Jul 2015   #4
GokAy

Windows 7 Ultimate x64 SP1
 
 

Oh, sorry

Something like this? batch - Programatically associate file extensions with application on Windows - Super User

Example used in Answer in above link:
Code:
Assoc .php=phpfile
Ftype phpfile="C:\Program Files (x86)\Notepad++\notepad++.exe" %1
My System SpecsSystem Spec
25 Jul 2015   #5
unko

Win7x64
 
 

It looks good but didn't work for me! It would set the right icon anyway.. Here's what i tried :

Quote:
Assoc .gp4=gp4file
Ftype .gp4=gp4file="D:\Apps\GuitarPro5Portable\GuitarPro5Portable.exe" %1
You may think pointing to portable apps doesn't work but it does when i do manually.
My System SpecsSystem Spec
25 Jul 2015   #6
GokAy

Windows 7 Ultimate x64 SP1
 
 

Code:
Assoc .gp4=gp4file
 Ftype (.gp4=)gp4file="D:\Apps\GuitarPro5Portable\GuitarPro5Portable.exe" %1
The bold part is incorrect, does it work if you delete that bit? Or a typo?

See
Code:
Assoc .gp4=gp4file
Ftype gp4file="D:\Apps\GuitarPro5Portable\GuitarPro5Portable.exe" %1
edit: bold is hard to see, I put parenthesis around it too
My System SpecsSystem Spec
25 Jul 2015   #7
unko

Win7x64
 
 

It works indeed, thanks! However as i said, it doesn't fix the icon correctly
My System SpecsSystem Spec
25 Jul 2015   #8
GokAy

Windows 7 Ultimate x64 SP1
 
 

See if this works better (taken from windows - Associate a File Type with a Specific Program - Super User)

Save as .bat file
Code:
set ftypename=potato_xxx_file
set extension=.potato
set pathtoexe="C:\potato.exe"
set pathtoicon=""

if %pathtoicon%=="" set pathtoicon=%pathtoexe%,0
REG ADD HKEY_CLASSES_ROOT\%extension%\ /t REG_SZ /d %ftypename% /f
REG ADD HKLM\SOFTWARE\Classes\%ftypename%\DefaultIcon\ /t REG_SZ /d %pathtoicon% /f
ftype %ftypename%=%pathtoexe% "%%1" %%*
assoc %extension%=%ftypename%
Quote:
Some hints:

ftypename - FileType name can be random but should be unique.

extension - A filename extension. Examples of filename extensions are .png, .jpeg, .exe, .dmg

pathtoexe - Full executable path.

pathtoicon - Full path to icon or executable file with selected icon. If icon path empty then default icon from exe will be used. If want use custom icon change set pathtoicon="" for example to set pathtoicon="C:\icons\potato.ico".

Works atleast in Windows 7.
My System SpecsSystem Spec
26 Jul 2015   #9
unko

Win7x64
 
 

Yes it works, thank you! Now i gotta make a list of all the needed extensions.. ^^
My System SpecsSystem Spec
26 Jul 2015   #10
GokAy

Windows 7 Ultimate x64 SP1
 
 

Nice
My System SpecsSystem Spec
Reply

 Making a file (bat?) to automatically create files associations?




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
File associations help!
My friend was messing around on my laptop and when I got it back everything was changed to iTunes. Although it says google chrome it shows an iTunes logo and will launch iTunes if clicked. This happened about six months ago. I tried for months to get it fixed but I ended up uninstalling iTunes so...
General Discussion
Help create .iso file from zip files!
Dear friends, Okay,i've downloaded the 4GB .iso file for my Home Premium 64-bit from Digital River (Link kindly provided by Britton30). It has downloaded as.zip files. I have WinZip 12 Pro. I am providing a snapshot of the .zip files. Kindly hand-guide me from here on as to...
Installation & Setup
Any way to prevent notepad or Emacs from making file associations?
I have an ongoing problem with using Emacs on a Win7 machine. When I edit a .bat file and save the file, Emacs updates the registry with an association to 'open' .bat files with the Emacs editor. Batch files then fail to run properly, as they get open with Emacs rather then simply being run by a...
General Discussion
Looking to create shortcut automatically for all files added to folder
Hello, I am looking to setup a system (through windows or 3rd party software) that automatically creates a shortcut, in a specified folder, every time a new file/folder is added to a specific folder or sets of folders. For example consider the download folder for a Torrent application. All...
General Discussion
file associations
I am experiencing a change in the way my PC works. If I do Start>Computer and then click on, say, my C: drive (but it happens for all drives) I get that darned message "The file does not have a program associated with it for performing this action....etc". If I right click and choose "open", then...
General Discussion
How to create a batch file that will move files based on the file type
How to create a batch file that will move files based on the file type? My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 18:10.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App