Newton Posted July 7, 2008 Posted July 7, 2008 HI I need a script or a way to change the file association for .wmv files to Windows media player, something automatic that works though GP or start up script, tryed looking at Ftype but couldn't get it right. Cheers
Newton Posted July 7, 2008 Author Posted July 7, 2008 My Google skills have improved in the last ten minutes, found the answer! Option Explicit Dim objShell set objShell = WScript.CreateObject ("WScript.Shell") '---------------------------------------------------------------- ' Don't edit above here ' ' Below is an example of associating PDF files with AcroRd32.exe ' You can change this to whatever you need, and just ' copy and paste the line over again to add more associations. '----------------------------------------------------------------- addFileAssociation ".wmv", "wmplayer.exe" '------------------------- ' Don't edit below here '------------------------- Sub addFileAssociation( fileExt, whichApp ) If ( Left(fileExt, 1) <> "." ) Then fileExt = "." & fileExt End If objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & fileExt & "\Application", whichApp End Sub
Michael Posted July 7, 2008 Posted July 7, 2008 I've done this before using registry entries which run silently through a logon script. Firstly manually create the new file association, then go into the registry. I exported the four entries for a custom JBR file extension: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.jbr] @="jbr_auto_file" Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\jbr_auto_file] @="" [HKEY_CLASSES_ROOT\jbr_auto_file\shell] [HKEY_CLASSES_ROOT\jbr_auto_file\shell\open] [HKEY_CLASSES_ROOT\jbr_auto_file\shell\open\command] @="\"C:\\jetsoft\\COUNTIT.EXE\" \"%1\"" Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.jbr] @="jbr_auto_file" Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jbr_auto_file] @="" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jbr_auto_file\shell] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jbr_auto_file\shell\open] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jbr_auto_file\shell\open\command] @="\"C:\\jetsoft\\COUNTIT.EXE\" \"%1\"" Run the registry files silently using: regedit /S \\servername\share\REGFILE.reg
Newton Posted July 7, 2008 Author Posted July 7, 2008 Cheers, I was looking along the right lines with the registry, but got distracted and the curry last night hasn't helped.
karldenton Posted July 7, 2008 Posted July 7, 2008 Thanks for that info too. If you run a reg file on logon, will it still work with student permissions? tried a printer script before but didn't work on student logon.
Michael Posted July 11, 2008 Posted July 11, 2008 Logon/startup scripts are run with full administrator rights as far as I am aware.
DMcCoy Posted July 11, 2008 Posted July 11, 2008 Logon/startup scripts are run with full administrator rights as far as I am aware. Only startup/shutdown scripts. Logon are run as the user.
Michael Posted July 11, 2008 Posted July 11, 2008 Surely you'd need some form of administrator access rights to the registry? I have registry files which install silently through logon scripts.
maniac Posted July 11, 2008 Posted July 11, 2008 Surely you'd need some form of administrator access rights to the registry? I have registry files which install silently through logon scripts. As far as I know you can change the HKEY_CURRENT_USER part of the registry with a logon script, but not the HKEY_LOCAL_MACHINE and other parts normally, unless the user running the script has the rights to do this. W With a machine startup script you can change any part of the registry using a script, as the script is run under the system account (same account that most windows services run under) which has rights to do this. I think I'm correct on this anyway. Mike.
cookie_monster Posted July 11, 2008 Posted July 11, 2008 (edited) startup/shutdown scripts run under the local system account, logon scripts run under the current user account so HKCU can be written to by any user as it's their hive but other hives e.g. HKLM can only be written to if the logon script is run by an admin user (possibly a power user as it's a subset of admins rather than a superset of users and has all sorts of odd permissions). Newton: also take a look at the assoc command http://support.microsoft.com/kb/184082 Edited July 11, 2008 by cookie_monster
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now