Hello
Im stuck for some reason that I dont know this is not working any advice on how to change default file associations would be highly appreciated.
this is what I have so far… thank you
[string]$extension = 'txt' [string]$executable = "C:\Program Files (x86)\Notepad++\notepad++.exe" if (-not (Test-Path $executable)) { $errorMessage = "`'$executable`' does not exist, not able to create association" throw $errorMessage } $extension = $extension.trim() if (-not ($extension.StartsWith("."))) { $extension = ".$extension" } $fileType = Split-Path $executable -leaf $fileType = $fileType.Replace(" ", "_") $elevated = @" cmd /c "assoc $extension=$fileType" cmd /c 'ftype $fileType="$executable" "%1" "%*"' New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT Set-ItemProperty -Path "HKCR:\$fileType" -Name "(Default)" -Value "$fileType file" -ErrorAction Stop "@ iex $elevated