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
474 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
ID: 36490236
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
ID: 36490374
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
ID: 36490505
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Assisted Solution

by:cscuvic
cscuvic earned 0 total points
ID: 36491795
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
ID: 36492407
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
ID: 36521440
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

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

820 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