1

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.

3
  • "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, 2017 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) Aug 31, 2017 at 17:06
  • You still need Administrator permissions, to do what you want, based on the information you provided.
    – Ramhound
    Aug 31, 2017 at 17:13

1 Answer 1

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.

6
  • 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. Sep 1, 2017 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, 2017 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. Sep 2, 2017 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) Sep 2, 2017 at 1:23
  • 1
    I'm not in IT or anything. I'm just a regular user that users many workstations day-to-day. But our IT didn't make many modifications from the default in WIN10 - just things like removing the Windows Store and creating some extra desktop icons. Windows 7 used to be heavily customized. Plus, I didn't need to change the defaults to WPV or WMP because that WAS the default. Windows 10's defaults ALL need to be changed. I hate that Microsoft grants users more rights through the GUI than through scripting - for the exact same thing! Sep 2, 2017 at 11:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .