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: Associate different default program with ext for command line only

06 Mar 2016   #1
djeyewater

Windows 7 Business x64
 
 
Associate different default program with ext for command line only

In Windows I have Scite (a text editor) set as the default program to open .pl files. That's fine when using explorer. But on the command line I would like to have a different program open .pl files. So basically, different defaults for explorer and cmd. How would I do this?


My System SpecsSystem Spec
.
06 Mar 2016   #2
UsernameIssues

W7 Pro SP1 64bit
 
 

When using command line, can you use:
path to different app [space] path to pl file
My System SpecsSystem Spec
06 Mar 2016   #3
djeyewater

Windows 7 Business x64
 
 

Well, you can do that, but my question is about setting a default program for the file extension.
My System SpecsSystem Spec
.

06 Mar 2016   #4
UsernameIssues

W7 Pro SP1 64bit
 
 

See method #5 in this thread: windows - Associate a File Type with a Specific Program - Super User

You will need to set it back to SciTE after the bulk of the batch file runs.
My System SpecsSystem Spec
06 Mar 2016   #5
djeyewater

Windows 7 Business x64
 
 

Unfortunately that didn't work for me:
Code:
C:\Users\Djeyewater>ASSOC | grep '^^.pl='
.pl=Perl

C:\Users\Djeyewater>FTYPE | grep 'Perl'
Perl="C:\Perl64\bin\perl.exe" "%1" %*
PerlScriptFile=C:\Windows\System32\WScript.exe "%1" %*
But when I open a .pl file through cmd it still opens in Scite. I've tried restarting as well, but to no effect.

Besides, if you need to set the default program back to what you want for opening the files via explorer when you're done on the command line, then that's not really what I wanted anyway. I think the answer to my question must simply be that it is not possible to have the command line and explorer use different default programs for the same extension.
My System SpecsSystem Spec
06 Mar 2016   #6
UsernameIssues

W7 Pro SP1 64bit
 
 

I would not expect Windows to have separate default program association for Explorer and command. Both read thru the same list of file extensions/associations to start stuff. I doubt that you can double click on a pl file within Explorer and have SciTE open the file for editing and have batch files run pl files by default. Maybe some other forum member knows how to do that.

Changing the association (and then changing it back) within each batch file might be a work around until someone else posts to your thread. Or use the method I mentioned in post #2.

It appears that you did not use an elevated command prompt or maybe you changed the directory before making a copy of the info that you posted. Normally, the directory would be: C:\Windows\system32> for an an elevated command prompt.

If you look at the help offered via FTYPE /?
...you should see that MS used the pl extension on their example:

Associate different default program with ext for command line only-ftype.png


My System SpecsSystem Spec
07 Mar 2016   #7
djeyewater

Windows 7 Business x64
 
 

The reason the directory was different was because I was checking from an unelevated prompt after restarting the computer (which I did after setting from an elevated prompt and finding the changed settings had no effect). As you can see from the output I included in my post, it had registered the type and extension correctly. If it was possible to temporarily set the extension handler by using an unelevated command line, that would be a nice hack to achieve what I'm looking for. But sadly not.
My System SpecsSystem Spec
Reply

 Associate different default program with ext for command line only




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
I can't associate portable program as default program
I am trying to associate kmplayer.exe for these 3 file types - avi,mp4,flv. But whatever i try Window 7 is just refusing to recognize the kmplayer.exe file. My KMPlayer is in portable format. What can i do to make KMPlayer as default player for these file types or is there any third party...
Software
Executing command line command anywhere ?
I want to create a setup whereas a command line command can be run from any directory/folder, without having to be in the directory/folder whereas the command line command resides ?
General Discussion
Default Programs/Associate a file type or protocol with a program BUG
Trying to change some file associations, so following the standard procedure: Default Programs Associate a file type or protocol with a program When it tries to load the file extension list ('Loading....'), I get the messages: Windows explorer has stopped working Windows is checking...
General Discussion
may i know the firewall command line to block a program?
Hi may i know the firewall command line to block a program in and out? i did a search a lot ,but i need only the command line to block a program thanks
System Security
Cannot associate program with file
I am trying to associate mp3's with GOM player. I once had this associate but changed it to WMP but want it back to GOM. When I try to change the associate to gom by selecting gom.exe(gom doesn't show up in the normal list) then click ok it defaults to something else(usually the top program in...
Music, Pictures & Video
"there was a problem sending a command line to program"
when i try to open my yahoo messenger account or a html doc. i get this pop up message: "there was a problem sending a command line to program". any suggestions? thanks
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 10:13.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App