0

Windows 10 has the wonkiest Default Programs assigned and I need to be able to quickly change them on different machines (i.e. create a script). I am trying to use assoc and ftype to accomplish that.

This is the batch file I tried to run - simple enough to start with. PS1 files usually open in Notepad, which makes no sense as they should open in the PowerShell ISE, so that is what I tried to do here:

@echo off
TITLE Associating File Types With Applications for %username%
assoc .ps1=Microsoft.PowerShellScript.1
ftype Microsoft.PowerShellScript.1=powershell_ise.exe
pause

The pause was simply so I could capture the following error when it ran:

Access is denied.
Error occurred while processing: .ps1.
Access is denied.
Error occurred while processing: Microsoft.PowerShellScript.1.
Press any key to continue . . .

Double access denied! The way the script is currently written, neither assoc or ftype work. I can change Default Programs through the GUI, so I should be able to script it as well. Unfortunately, Microsoft doesn't make it easy to script when you are not an Administrator.

I don't know if the assoc part is actually necessary - it seems like only ftype is needed in a script as that is what actually changes the file association. That was in all the examples though so I included it.

How can I change default programs as a standard user without any administrative rights? Thankfully, we now have access to the Registry, so if I can do the same thing with a REG file, that would work as well. I need to be able to associate the following file types with the following programs:

  • PS1: PowerShell ISE
  • PDF: Adobe Acrobat Reader DC
  • Make Windows Photo Viewer (not Photos) the default viewer for any type of image. I already have a script that adds WPV to the "Open With" menu.
  • Make Windows Media Player the default viewer for any type of video file.
  • Make Internet Explorer the default browser (as opposed to Edge). Our domain has a policy that makes Chrome the default browser whenever it runs, so I may reapply this more often.
  • HTML/CSS/JS: "T:\Notepad++\Notepad++Portable.exe"

Apart from Chrome, domain policies do not affect default programs.

  • "How can I change default programs as a standard user?" - You don't. It appears like your domain policy will prevent doing so. Even if you change the registry it would be overwritten the next time group policy updated on your machine. – Ramhound Aug 31 '17 at 17:05
  • @Ramhound No, it isn't overwritten, just the Chrome thing. Everything else, if I change in the GUI, it sticks. (Also, duplicate comments? Might want to delete one) – InterLinked Aug 31 '17 at 17:06
  • You still need Administrator permissions, to do what you want, based on the information you provided. – Ramhound Aug 31 '17 at 17:13
0

Without rights to the elevated command prompt you not be able to run a script like that. Elevated meaning you can right click on cmd and select run as administrator.

  • I can't leverage Group Policy at all since I'm not a local admin, let alone a domain admin. I definitely don't have write rights to system32. I looked at both, but it looks like they talk about deploying when the machine is setup, not at will after first or whatever logon. – InterLinked Sep 1 '17 at 10:23
  • I'll edit my answer. I thought you were trying to come up with a solution for a network. I appologize – Fixitrod Sep 1 '17 at 11:03
  • Yeah, that's right, I'm doing this on a computer by computer basis - all interactively - , not for a whole network. I guess I should have been more clear, though GP is definitely the way to do anything at the network level. – InterLinked Sep 2 '17 at 1:21
  • So do you just recommend in my batch file adding an echo statement saying "Please manually go change settings X, Y, Z, F, L, etc." and then adding pause after that, so I don't forget and manually change it, and then come back and hit ENTER to continue the setup script? It would be a really awkward thing to do, but that's the closest thing I can think of to automation, since my goal is a) save time and b) not forget to configure something (hence automation) – InterLinked Sep 2 '17 at 1:23
  • Just make a check list on paper or in notepad or something. You could put a less detailed list and a step by procedure below in case you forget or someone else needs to do it. It could be on a network share or zip drive. If you have the computer local admin password you can just thought click on cmd and select run as administrator. It'll prompt for password then you can run the script. Seems strange your going to set up multiple computers and can't even login as an admin of any kind. – Fixitrod Sep 2 '17 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.