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
473 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
winrar and 7zip compression not ok 3 35
Windows NLB cluster 3 30
Windows shadowcopy - space allocated - exclusive? 4 27
"Recent" shortcut button missing in Windows 10 7 42
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

810 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