Windows 10: How to set file associations in PowerShell so that .ps1 is exec by PS

Discus and support How to set file associations in PowerShell so that .ps1 is exec by PS in Windows 10 Software and Apps to solve the problem; How to set file associations in PowerShell so that a .ps1 Script is executed by PowerShell when double clicked. I tried: Code: cmd /c "ASSOC... Discussion in 'Windows 10 Software and Apps' started by WinTenUsr, Nov 2, 2017.

  1. WinTenUsr Win User

    How to set file associations in PowerShell so that .ps1 is exec by PS


    How to set file associations in PowerShell so that a .ps1 Script is executed by PowerShell when double clicked.
    I tried:
    Code: cmd /c "ASSOC .ps1=Microsoft.PowerShellScript.1" cmd /c "FTYPE Microsoft.PowerShellScript.1=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"" ""%1"""[/quote] No error is shown when executed and the desktop is shortly after refreshed, but unfortunately the .ps1 Script is still not executed by PowerShell.

    I noticed under Code: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ps1\[/quote] a Code: UserChoice[/quote] Folder is created when one manually sets a "Open with" program. This folder contains two important entries:
    Code: 1.) Hash REG_SZ wk2qS8kKVnU <- random value automatically created by Windows 2.) ProgId REG_SZ Applications\notepad.exe[/quote] But unfortunately one can't manually set a Hash since the Hash value is created automatically by Windows, so the value is kinda secret? -- additionally, the value has a different value each time, despite the a same program name.

    :)
     
    WinTenUsr, Nov 2, 2017
    #1

  2. Missing apps

    You just need to extract PS1 file from ZIP and then right click the PS1 file and selecting Run with powershell will reinstall all the apps.
     
    Sumit Dhiman2, Nov 2, 2017
    #2
  3. Szewczyk Win User
    Setting .PS1 scripts default program to Powershell is soooooooooooo freak'in difficult

    In Windows 10, .PS1 by default program is set to notepad, yeah go wonder, even though the description for a .PS1 file is "Windows Powershell Script", then of course trying to set it to Powershell brings up a dialog that asks "Which app do you want it to
    set to" and of course there is no app named Powershell. Then the dialog wants you to search the computer to find Powershell even though it is Microsoft's major player in scripting, the Windows 10 can't find, I have to hunt and peck to find the executable.
     
    Szewczyk, Nov 2, 2017
    #3
  4. dalchina New Member

    How to set file associations in PowerShell so that .ps1 is exec by PS

    How do you do that?
    - have you tried rt clicking your .ps1 file, Open With, and browse to psexec.exe? "Look for another app"?

    Or you could use (freeware)

    How to set file associations in PowerShell so that .ps1 is exec by PS [​IMG]
     
    dalchina, Nov 2, 2017
    #4
  5. Kari Win User
  6. WinTenUsr Win User
    Sorry, I forgot to mention that it would be set through a GPO, so no user interaction required. All the user would do is to double click the script and PowerShell would execute it.
     
    WinTenUsr, Nov 5, 2017
    #6
  7. Kari Win User
    That can't be done. PowerShell scripts cannot be run by double clicking their icon. The only way is to use shortcut as told in tutorial I linked to.
     
    Kari, Nov 5, 2017
    #7
  8. WinTenUsr Win User

    How to set file associations in PowerShell so that .ps1 is exec by PS

    Thanks, good or not good to know that this can't be done (up to Win7 it was possible AFAIK). I decided to start the PowerShell script through .cmd/.bat, as these are already set to be executed by CMD.
     
    WinTenUsr, Apr 5, 2018
    #8
Thema:

How to set file associations in PowerShell so that .ps1 is exec by PS

Loading...
  1. How to set file associations in PowerShell so that .ps1 is exec by PS - Similar Threads - set file associations

  2. Why can't I edit PowerShell .ps1 files?

    in Windows 10 Gaming
    Why can't I edit PowerShell .ps1 files?: When I right click any .ps1 file and try to edit it, I get the message below. This is a new computer if that matters. But the .ps1 files are stored on OneDrive, not sure why there is a problem....
  3. Why can't I edit PowerShell .ps1 files?

    in Windows 10 Software and Apps
    Why can't I edit PowerShell .ps1 files?: When I right click any .ps1 file and try to edit it, I get the message below. This is a new computer if that matters. But the .ps1 files are stored on OneDrive, not sure why there is a problem....
  4. Rundll32 created PowerShell .ps1 or .pms1 files

    in Microsoft Windows 10 Store
    Rundll32 created PowerShell .ps1 or .pms1 files: Hello,I need to understand this process tree, from the eldest to the newest:C:\WINDOWS\system32\services.exeC:\WINDOWS\system32\svchost.exe -k wsappx -p -s AppXSvcC:\WINDOWS\system32\rundll32.exe" "C:\WINDOWS\SYSTEM32\EDGEHTML.dll",#141...
  5. Rundll32 created PowerShell .ps1 or .pms1 files

    in Windows 10 Gaming
    Rundll32 created PowerShell .ps1 or .pms1 files: Hello,I need to understand this process tree, from the eldest to the newest:C:\WINDOWS\system32\services.exeC:\WINDOWS\system32\svchost.exe -k wsappx -p -s AppXSvcC:\WINDOWS\system32\rundll32.exe" "C:\WINDOWS\SYSTEM32\EDGEHTML.dll",#141...
  6. Rundll32 created PowerShell .ps1 or .pms1 files

    in Windows 10 Software and Apps
    Rundll32 created PowerShell .ps1 or .pms1 files: Hello,I need to understand this process tree, from the eldest to the newest:C:\WINDOWS\system32\services.exeC:\WINDOWS\system32\svchost.exe -k wsappx -p -s AppXSvcC:\WINDOWS\system32\rundll32.exe" "C:\WINDOWS\SYSTEM32\EDGEHTML.dll",#141...
  7. How to convert PowerShell script (PS1) file to EXE with IExpress on Windows 10

    in Windows 10 News
    How to convert PowerShell script (PS1) file to EXE with IExpress on Windows 10: [ATTACH]You can wrap an executable file around a PowerShell script (PS1) so that you […] This article How to convert PowerShell script (PS1) file to EXE with IExpress on Windows 10 first appeared on TheWindowsClub.com. read more...
  8. How to install PS Exec on a Windows 10 PC?

    in Windows 10 Software and Apps
    How to install PS Exec on a Windows 10 PC?: I watched some Youtube videos on how to "install" PS Exec. They are mostly Windows 7 tutorials. Seems like Windows 10 is a bit different. I tried to add it to Environmental Variables>System Variables>Path Edit>New>%SystemRoot%\System32\PSTools but it's not working. I have...
  9. assign powershell to ps1

    in Windows 10 Ask Insider
    assign powershell to ps1: hi win10 1909 here. i want to assign powerhell to open ps1 files. now notepad.exe is assigned, and i cant change this to powershell is there a way to assign powershell to ps1 files ? submitted by /u/rtl33 [link] [comments]...
  10. On how to run a .ps1 file as Administrator

    in Windows 10 Support
    On how to run a .ps1 file as Administrator: Hello everyone, If you have had a chance of going through the great Brink's Tutorial Apps - Uninstall in Windows 10 (I strongly advice you do), you may have noticed that, if you wish to automatize, at least to a certain extent, the procedure of getting rid of Windows 10...

Users found this page by searching for:

  1. how to associate file types in powershell

    ,
  2. set file associations using powershell

    ,
  3. ftype using powershell