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: Simple .bat question


09 Mar 2013   #1

windows 7 home premium x64 service pack 1
 
 
Simple .bat question

Hi all,
Does anybody happen to know what command I should be using in a batch file to open a file with a program other than the default for that extension? Or alternatively, as a workaround, how to set the default for a given extension in a batch file and then set it back again?
Specifically I'm working with a program that has multiple .cfg files for when I'm doing various things, so I'm trying to make batch files to open the appropriate one at the appropriate time but want to leave notepad as the default program to open them for ease of editing.
Thanks,
Simon

My System SpecsSystem Spec
.

09 Mar 2013   #2
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

Hello Simon, and welcome to Seven Forums.

You could use this in the BAT file to open a file with a supported program of your choice.

start "Full path to .exe of program" "Full path of file with extension"


For example, to open a .txt file in Wordpad.

start "C:\Windows\write.exe" "C:\Users\(user-name)\My Documents\My text file.txt"


Hope this helps,
Shawn
My System SpecsSystem Spec
09 Mar 2013   #3

windows 7 home premium x64 service pack 1
 
 

That's great, thank you very much.
My System SpecsSystem Spec
.


09 Mar 2013   #4
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

You're most welcome Simon.
My System SpecsSystem Spec
Reply

 Simple .bat question




Thread Tools



Similar help and support threads for2: Simple .bat question
Thread Forum
Just a simple question about my RAM Performance & Maintenance
Simple question . General Discussion
Really simple question General Discussion
Simple question BSOD Help and Support
Solved Please help ,e with this simple question!! Performance & Maintenance
A simple question...i think Network & Sharing
simple question 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 09:50 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33