Solved

Change a file association so that it will take effect for any user that logs onto that machine.  Windows 7 Enterprise.

Posted on 2011-09-06
6
469 Views
Last Modified: 2012-08-14
I want to be able to change the default file association for the .cs file extension on a Windows 7 Enterprise box.  Right now, Visual Studio 2010 is installed on the machine and when a user double clicks on a file with the .cs extension, Visual Studio is the one that opens,  However, I want to have it open by default with another program called MonoDevelop.  

I have tried logging on as an administrator and doing it through Control Panel | Default Programs, but that does not seem to affect all subsequent users that log on.  The machine is locked down so that a regular user could not make this change when they log on, in addition, profiles on the machine are wiped out every night so even if the user did change it for themselves, they would have to do over and over again.  

I would like to be able to change it via a registry edit for the default user (but don't know how) or I've read it can be done in the HKLM | Software | Classes and it will affect all users.  

I can see the .cs file association key in the HKLM | Software | Classes and the registry keys look like this:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cs] "Content Type"="text/plain" "PerceivedType"="text" @="VisualStudio.cs.9.0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cs\OpenWithProgids] "VisualStudio.cs.9.0"="" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cs\OpenWithProgids\Shared] @="Shared key to keep this from being removed with install/uninstall of side-by-side components." [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.cs\PersistentHandler] @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

If anyone can help me I would greatly appreciate it.  

0
Comment
Question by:cscuvic
  • 3
  • 2
6 Comments
 
LVL 66

Accepted Solution

by:
johnb6767 earned 83 total points
Comment Utility
You should try it here....

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\VisualStudio.cs.9.0

Under there, you will see a "Shell>Open>Command", and try changing the path there.....
0
 

Author Comment

by:cscuvic
Comment Utility
Wow, that was fast :)

I just tried changing the path to point to the MonoDevelop.exe:
C:\Program Files\MonoDevelop\bin\MonoDevelop.exe (I did not put it in quotes)

Then tested it as a regular user.  When I double clicked on the .cs file, MonoDevelop opened instead of Visual Studio (which is great), but there is also an error that says:  There was a problem sending the command to the program.  

Are there other entries within that registry key that I need to amend?

Thank you again,
0
 
LVL 3

Assisted Solution

by:OliverLo
OliverLo earned 167 total points
Comment Utility
Hi Csuvic,

If you want to perform the change on more that one computer and can configure Group Policies then you could try to use Windows 7 preferences:
1
Click the Windows server "Start" button and then click "Administrative Tools." Click "Group Policy Management Console" to open the policy manager.
2
Right-click the group policy server name and select "Edit." In the list of options, click "Computer Configuration," "Preferences," then "Control Panel Settings."
3
Right-click the "Folder Options" icon and select "New," then "File Type." This opens a new configuration window.
4
Select "Replace" from the "Actions" drop-down box. Select "File Extension" from the "File Type Settings" drop-down box.
5
Enter the file extension for the new group policy. Select Monodevelop.exe from the list of software in the "Association" list. Click "OK" to save your settings and close the group policy editor.
6
Force the policy update on one of the target computer:
gpupdate /force /target computer

You should then see that monodevelop replaced Visual Studio to open this specific extension.


0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Assisted Solution

by:cscuvic
cscuvic earned 0 total points
Comment Utility
Hi, I've tried the gpo solution, but I have variances from the instructions you posted.  
In step 2, I right-click the GPO that I want to add the file association change to
In step 3, I make the choices as described
But in Step 4, "Select "File Extension" from the "file Type Settings" drop down box is not there.  What I have for choices in the "New File Type Properties" dialog box that pops up is: Action (which I chose Replace), File extension: (which I typed in cs), and then there is an Associated class: (with a drop down box that does not contain the choice of File Extension, or my MonoDevelop program).  

0
 
LVL 3

Assisted Solution

by:OliverLo
OliverLo earned 167 total points
Comment Utility
On my own server it is working if:
- I set Associated Class to ".NET managed resources file"
- I tick the checkbox "Configure class settings"
- I click on New in the Action section
- In the New Action windows
   > I write Replace in Action field
   > I write the path to monodevelop in "Application used to perform action"
- I save all these settings
- I update the GPO for the computer

I checked and it's working for different users...
0
 

Author Closing Comment

by:cscuvic
Comment Utility
Both solutions tackled the problem from different angles and both did what they said they would.  I ended up going with the registry path change (solution 1) but will look at implementing the gpo solution at a later date.  Thanks to both johnb6767 and oliverlo for their quick responses.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now