[HELP] Context-menu "Add ENV path"


forart

Member
Local time
3:45 AM
Posts
4
OS
Windows 11 24H2 + Creosynth playbook
Hi everyone,
I found this interesting article for but their script uses an external app: how to modify or create it from scratch ?

EDIT: cross-asked here too.

Thanks in advance to anyone that will/can help !
 
Windows Build/Version
Windows 11 24H2

My Computers

System One System Two

  • OS
    Windows 11 24H2 + Creosynth playbook
    Computer type
    PC/Desktop
    Manufacturer/Model
    Main A/V workstation
    CPU
    i5-12600
    Motherboard
    Gigabyte Z690 UD DDR4 (rev. 1.x)
    Memory
    2 x G.Skill F4-4000C18D-16GVK (32Gb)
    Graphics Card(s)
    Intel® UHD Graphics 770 (iGPU)
    Sound Card
    Topping E50
    Monitor(s) Displays
    Samsung U32H850UMN + Hanns-G HW173D
    Screen Resolution
    UHD (3840 x 2160)
    Hard Drives
    Crucial P5 Plus 2 TB (CT2000P5PSSD8) + 2 x WD Elements - 4 TB (WDBWLG0040HBK)
    PSU
    EVGA 450 B3
    Case
    Thermaltake Commander MS-I SE
    Cooling
    Thermalright Peerless Assassin 120 + 3 x Corsair AF 120
    Keyboard
    Microsoft Sidewinder X6
    Mouse
    Microsoft Trackball Optical (D67-00001)
    Internet Speed
    FTTH 5 Gbps
    Browser
    Firefox / Librewolf / Mull
    Antivirus
    none
  • Operating System
    Windows 11 24H2 + Creosynth playbook
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 3000 D15U
    CPU
    i5-12500T
    Memory
    G.Skill Ripjaws F4-3200C22D-32GRS
    Graphics card(s)
    Intel® UHD Graphics 770 (iGPU)
    Sound Card
    Realtek ALC256 (integrated)
    Hard Drives
    Crucial P5 Plus 1 TB (CT1000P5PSSD8)
    PSU
    Dell LA130PM121
    Case
    Dell mff
    Browser
    Firefox / Librewolf / Mull
    Antivirus
    none
    Other Info
    Portable AV workstation
Here we go, this (copilot-driven generated) code adds a function in the context menu to add the selected path to User Environment Variables:

Powershell:
[-HKEY_CLASSES_ROOT\Directory\shell\AddToEnvVars]
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\AddToEnvVars]
@="Add path to User Environment Variables"
"Extended"=""
"HasLUAShield"=""
"NoWorkingDirectory"=""
"Position"="middle"

[HKEY_CLASSES_ROOT\Directory\shell\AddToEnvVars\command]
@="powershell -windowstyle hidden -command \"[System.Environment]::SetEnvironmentVariable('Path', [System.Environment]::GetEnvironmentVariable('Path', 'User') + ';' + '%1', 'User')\""
"IsolatedCommand"="powershell -windowstyle hidden -command \"[System.Environment]::SetEnvironmentVariable('Path', [System.Environment]::GetEnvironmentVariable('Path', 'User') + ';' + '%1', 'User')\""

I've also found this interesting SO answer that avoids duplicates, but don't know how to integrate it.

Thanks for anyone will help.
 

My Computers

System One System Two

  • OS
    Windows 11 24H2 + Creosynth playbook
    Computer type
    PC/Desktop
    Manufacturer/Model
    Main A/V workstation
    CPU
    i5-12600
    Motherboard
    Gigabyte Z690 UD DDR4 (rev. 1.x)
    Memory
    2 x G.Skill F4-4000C18D-16GVK (32Gb)
    Graphics Card(s)
    Intel® UHD Graphics 770 (iGPU)
    Sound Card
    Topping E50
    Monitor(s) Displays
    Samsung U32H850UMN + Hanns-G HW173D
    Screen Resolution
    UHD (3840 x 2160)
    Hard Drives
    Crucial P5 Plus 2 TB (CT2000P5PSSD8) + 2 x WD Elements - 4 TB (WDBWLG0040HBK)
    PSU
    EVGA 450 B3
    Case
    Thermaltake Commander MS-I SE
    Cooling
    Thermalright Peerless Assassin 120 + 3 x Corsair AF 120
    Keyboard
    Microsoft Sidewinder X6
    Mouse
    Microsoft Trackball Optical (D67-00001)
    Internet Speed
    FTTH 5 Gbps
    Browser
    Firefox / Librewolf / Mull
    Antivirus
    none
  • Operating System
    Windows 11 24H2 + Creosynth playbook
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 3000 D15U
    CPU
    i5-12500T
    Memory
    G.Skill Ripjaws F4-3200C22D-32GRS
    Graphics card(s)
    Intel® UHD Graphics 770 (iGPU)
    Sound Card
    Realtek ALC256 (integrated)
    Hard Drives
    Crucial P5 Plus 1 TB (CT1000P5PSSD8)
    PSU
    Dell LA130PM121
    Case
    Dell mff
    Browser
    Firefox / Librewolf / Mull
    Antivirus
    none
    Other Info
    Portable AV workstation
Back
Top Bottom