"Run as TrustedInstaller" from Context menu

Discussion in 'Scripting' started by freddie-o, Dec 3, 2019.

  1. freddie-o

    freddie-o MDL Expert

    Jul 29, 2009
    1,571
    2,615
    60
    #101 freddie-o, Jul 28, 2024
    Last edited: Jul 28, 2024
    (OP)
    Here's what I've come up with.
    After Installing... the script opens PowerRun and notifies you to "Allow Command Line" so the "PowerRun.ini" gets saved there in the System folders
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. retest

    retest MDL Member

    Nov 2, 2010
    116
    63
    10
    The sec code is unique for each system and each windows installation in a system.

    PRun saves all sec codes generated. So it is, kind of, portable.
     
  3. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,177
    5,990
    150
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. freddie-o

    freddie-o MDL Expert

    Jul 29, 2009
    1,571
    2,615
    60
    #104 freddie-o, Jul 28, 2024
    Last edited: Jul 28, 2024
    (OP)
    Updated the script Registry values
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. retest

    retest MDL Member

    Nov 2, 2010
    116
    63
    10
    You might need a "if %arch%==x64 ..." for the start PRun commands.

    Any particular reason you skipped the /wait in the second start?

    -----
    One more suggestion, ;)

    Since PRun will be available on the users system, add a option for folders to "Open command prompt here as TI".

    What I use:
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\shell\Command Prompt here as TI\shell\35Command Prompt here as TI\command]
    @="\"C:\\Portable Programs\\RunAsTI\\PowerRun64.exe\" cmd.exe /s /k pushd \"%V\" & Title CMD as TI"
    
    If the above can be improved : anyone, please comment.
     
  6. freddie-o

    freddie-o MDL Expert

    Jul 29, 2009
    1,571
    2,615
    60

    No way for me to test on x86

    Code:
    @echo OFF
    
    @reg query HKU\S-1-5-19>nul 2>nul||(set 0="%~f0" %*&powershell -nop -c start cmd -args '/x/d/q/rcall',$env:0 -v runas&exit)
    
    :menu
    cd /d "%~dp0"
    
    if /i "%PROCESSOR_ARCHITECTURE%" equ "amd64" (set "arch=x64") else (set "arch=%PROCESSOR_ARCHITECTURE%")
    if "%PROCESSOR_ARCHITEW6432%" neq "" if /i "%arch%" neq "x86" if /i "%arch%" neq "x64" start %SystemRoot%\Sysnative\cmd.exe /C "%~dpnx0" %* & exit
    
    set "ROOT=%~dp0"
    set "DownloadFileName=PowerRun.zip"
    set "DownloadURI=https://www.sordum.org/files/download/power-run/PowerRun.zip"
    
    SetLocal EnableExtensions EnableDelayedExpansion
    
    echo.
    echo ____________________________________________________________
    echo.
    echo       "Run as TrustedInstaller" from the Context Menu
    echo ____________________________________________________________
    echo.
    echo.
    echo  [1]  Add "Run as TrustedInstaller" to the Context menu
    echo.
    echo  [2]  Remove "Run as TrustedInstaller" from the Context menu
    echo.
    echo.
    echo. [Q]  Quit
    echo.
    echo.
    echo ____________________________________________________________
    echo.
    echo.
    choice /C:12Q /N /M "Enter your choice :"
    if %errorlevel% equ 3 exit
    if %errorlevel% equ 2 (
       if exist "%SystemROOT%\System32\PowerRun.exe" (
           del /q %SystemRoot%\system32\PowerRun.exe >NUL
           del /q %SystemRoot%\system32\PowerRun.ini >NUL
           if not %arch%==x86 if not %arch%==arm del /q %SystemRoot%\SysWOW64\PowerRun.exe >NUL
           del /q %SystemRoot%\SysWOW64\PowerRun.ini >NUL
           reg delete "HKCR\batfile\shell\Run as TrustedInstaller" /f >nul 2>&1
           reg delete "HKCR\cmdfile\shell\Run as TrustedInstaller" /f >nul 2>&1
           reg delete "HKCR\cplfile\shell\Run as TrustedInstaller" /f >nul 2>&1
           reg delete "HKCR\exefile\shell\Run as TrustedInstaller" /f >nul 2>&1
           reg delete "HKCR\Microsoft.PowerShellScript.1\shell\Run as TrustedInstaller" /f >nul 2>&1
           reg delete "HKCR\mscfile\shell\Run as TrustedInstaller" /f >nul 2>&1
           reg delete "HKCR\regfile\shell\Run as TrustedInstaller" /f >nul 2>&1
    cls       
           echo.
           echo.Successfully uninstalled PowerRun and removed "Run as TrustedInstaller" from the Context menu.
       ) else (
    cls   
           echo.
           echo.PowerRun has already been removed.
       )
    )
    if %errorlevel% equ 1 (
       if not exist "%SystemROOT%\System32\PowerRun.exe" (
           @start "Downloading !DownloadFileName! file..." /wait /B powershell -c "(New-Object System.Net.WebClient).DownloadFile('!DownloadURI!', '%ROOT%\!DownloadFileName!')"
           if exist "%ROOT%\!DownloadFileName!" @start "Expanding !DownloadFileName! file..." /wait /B powershell -c "Expand-Archive -Force '%ROOT%\!DownloadFileName!' '%ROOT%'"
            if exist "PowerRun\PowerRun.exe" (
               if %arch%==x64 (
                   copy PowerRun\PowerRun_x64.exe %SystemRoot%\system32\PowerRun.exe /y >NUL
                   copy PowerRun\PowerRun.exe %SystemRoot%\SysWOW64\PowerRun.exe /y >NUL
               ) else (
                   copy PowerRun\PowerRun.exe %SystemRoot%\system32\PowerRun.exe /y >NUL
               )
               reg add "HKCR\batfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
               reg add "HKCR\batfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
               reg add "HKCR\cmdfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
               reg add "HKCR\cmdfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
               reg add "HKCR\cplfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
               reg add "HKCR\cplfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
               reg add "HKCR\exefile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
               reg add "HKCR\exefile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
               reg add "HKCR\Microsoft.PowerShellScript.1\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
               reg add "HKCR\Microsoft.PowerShellScript.1\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
               reg add "HKCR\mscfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
               reg add "HKCR\mscfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
               reg add "HKCR\regfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
               reg add "HKCR\regfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
    
    msg Console "PowerRun windows(s) will now open. Click on the 'File' menu and 'Allow Command Line' to disable the Cmd parameter restriction."           
               if %arch%==x64 (
                   start "" /wait %SystemRoot%\system32\PowerRun.exe           
                   start "" /wait %SystemRoot%\SysWOW64\PowerRun.exe
               ) else (
                   start "" /wait %SystemRoot%\system32\PowerRun.exe           
               )
    cls
               echo.
               echo.Successfully installed PowerRun and added "Run as TrustedInstaller" to the Context menu.
           )
    rmdir /q /s "PowerRun" >nul
    del /q /f "!DownloadFileName!" >nul
       ) else (
           echo.
           echo.PowerRun is already installed.
       )
    )
    echo.
    echo Press any key to go to the Main menu...
    pause >nul
    cls
    goto menu
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    #107 inTerActionVRI, Jul 29, 2024
    Last edited: Jul 29, 2024
    It will patch only the PowerRun that was opened.
    This is why the bellow method is effective. It will place the patched .ini in both Sustem32 and SysWOW64 folders.

    There are no need to execute for specified PowerRun arch. Just open the x86 before copy .exe and .ini to system32.
    The same ini will be used for any arch.

    Then you can start PowerRun after it is extracted to the ROOT folder. Then the .ini patched by PowerRun will be placed correctly.
    So the suggested adjustments to the code should be:

    Code:
    @echo OFF
    
    @reg query HKU\S-1-5-19>nul 2>nul||(set 0="%~f0" %*&powershell -nop -c start cmd -args '/x/d/q/rcall',$env:0 -v runas&exit)
    
    :menu
    cd /d "%~dp0"
    
    if /i "%PROCESSOR_ARCHITECTURE%" equ "amd64" (set "arch=x64") else (set "arch=%PROCESSOR_ARCHITECTURE%")
    if "%PROCESSOR_ARCHITEW6432%" neq "" if /i "%arch%" neq "x86" if /i "%arch%" neq "x64" start %SystemRoot%\Sysnative\cmd.exe /C "%~dpnx0" %* & exit
    
    set "ROOT=%~dp0"
    set "DownloadFileName=PowerRun.zip"
    set "DownloadURI=https://www.sordum.org/files/download/power-run/PowerRun.zip"
    
    SetLocal EnableExtensions EnableDelayedExpansion
    
    echo.
    echo ____________________________________________________________
    echo.
    echo       "Run as TrustedInstaller" from the Context Menu
    echo ____________________________________________________________
    echo.
    echo.
    echo  [1]  Add "Run as TrustedInstaller" to the Context menu
    echo.
    echo  [2]  Remove "Run as TrustedInstaller" from the Context menu
    echo.
    echo.
    echo. [Q]  Quit
    echo.
    echo.
    echo ____________________________________________________________
    echo.
    echo.
    choice /C:12Q /N /M "Enter your choice :"
    if %errorlevel% equ 3 exit
    if %errorlevel% equ 2 (
        if exist "%SystemROOT%\System32\PowerRun.exe" (
            del /q %SystemRoot%\System32\PowerRun.exe >NUL
            del /q %SystemRoot%\System32\PowerRun.ini >NUL
            if not %arch%==x86 if not %arch%==arm (
                del /q %SystemRoot%\SysWOW64\PowerRun.exe >NUL
                del /q %SystemRoot%\SysWOW64\PowerRun.ini >NUL
            )
            reg delete "HKCR\batfile\shell\Run as TrustedInstaller" /f >nul 2>&1
            reg delete "HKCR\cmdfile\shell\Run as TrustedInstaller" /f >nul 2>&1
            reg delete "HKCR\cplfile\shell\Run as TrustedInstaller" /f >nul 2>&1
            reg delete "HKCR\exefile\shell\Run as TrustedInstaller" /f >nul 2>&1
            reg delete "HKCR\Microsoft.PowerShellScript.1\shell\Run as TrustedInstaller" /f >nul 2>&1
            reg delete "HKCR\mscfile\shell\Run as TrustedInstaller" /f >nul 2>&1
            reg delete "HKCR\regfile\shell\Run as TrustedInstaller" /f >nul 2>&1
            cls
            echo.
            echo.Successfully uninstalled PowerRun and removed "Run as TrustedInstaller" from the Context menu.
        ) else (
            cls
            echo.
            echo.PowerRun has already been removed.
        )
    )
    if %errorlevel% equ 1 (
        if not exist "%SystemROOT%\System32\PowerRun.exe" (
            @start "Downloading !DownloadFileName! file..." /wait /B powershell -c "(New-Object System.Net.WebClient).DownloadFile('!DownloadURI!', '%ROOT%\!DownloadFileName!')"
            if exist "%ROOT%\!DownloadFileName!" @start "Expanding !DownloadFileName! file..." /wait /B powershell -c "Expand-Archive -Force '%ROOT%\!DownloadFileName!' '%ROOT%'"
            if exist "PowerRun\PowerRun.exe" (
                msg Console "PowerRun windows(s) will now open. Click on the 'File' menu and 'Allow Command Line' to disable the Cmd parameter restriction."
                start "" /wait /i "%ROOT%\PowerRun\PowerRun.exe"
    
                if not %arch%==x64 if not %arch%==arm64 (
                    copy PowerRun\PowerRun.exe "%SystemRoot%\System32\PowerRun.exe" /y >NUL
                )
                if not %arch%==x86 if not %arch%==arm (
                    copy PowerRun\PowerRun.exe "%SystemRoot%\SysWOW64\PowerRun.exe" /y >NUL
                    copy PowerRun\PowerRun_x64.exe "%SystemRoot%\System32\PowerRun.exe" /y >NUL
                    copy PowerRun\PowerRun.ini "%SystemRoot%\SysWOW64\PowerRun.ini" /y >NUL
                )
                copy PowerRun\PowerRun.ini "%SystemRoot%\System32\PowerRun.ini" /y >NUL
    
                reg add "HKCR\batfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
                reg add "HKCR\batfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
                reg add "HKCR\cmdfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
                reg add "HKCR\cmdfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
                reg add "HKCR\cplfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
                reg add "HKCR\cplfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
                reg add "HKCR\exefile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
                reg add "HKCR\exefile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
                reg add "HKCR\Microsoft.PowerShellScript.1\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
                reg add "HKCR\Microsoft.PowerShellScript.1\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
                reg add "HKCR\mscfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
                reg add "HKCR\mscfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
                reg add "HKCR\regfile\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "%SystemROOT%\System32\PowerRun.exe" /f >NUL
                reg add "HKCR\regfile\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
    
                cls
                echo.
                echo.Successfully installed PowerRun and added "Run as TrustedInstaller" to the Context menu.
            )
            rmdir /q /s "PowerRun" >NUL
            del /q /f "!DownloadFileName!" >NUL
        ) else (
            echo.
            echo.PowerRun is already installed.
        )
    )
    echo.
    echo Press any key to go to the Main menu...
    pause >nul
    cls
    goto menu
    
     
  8. Will die with Win 11 - R.I.P.!!!!

    :D.
     
  9. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,786
    7,748
    210
    Has already died with the advent of Win11. Server-side, it's dead for years and already smelling bad.

    x86 has a historical problem, though. Tons and tons of software, either totally or partially 32bit. Many installers are, too. And who knows what else and where else 32bit code is still used in Windows. At least WoW64 will be with us for the foreseeable future.

    We managed to finally get rid of 16bit code, though. :evil2:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. freddie-o

    freddie-o MDL Expert

    Jul 29, 2009
    1,571
    2,615
    60
    Thanks for cleaning up the script
    My script opens PowerRun in both System32 and SysWOW64 folders so the INI is saved there. Same results

    But I agree that patching the INI before copying the PowerRun files in System32 and SysWOW64 folders is cleaner and less to do.

    I'll add the script to the OP
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. Wtarkan is cool too ;)... :blush: ...
     
  12. inTerActionVRI

    inTerActionVRI MDL Expert

    Sep 23, 2009
    1,748
    3,575
    60
    #112 inTerActionVRI, Jul 29, 2024
    Last edited: Jul 29, 2024
    If you look at the download scheme I made in my script, it is only to check if the zip file present (already downloaded) is the same as the one on the server. If the dates are different, we know that there is a new version of PowerRun, so it downloads the new version.

    Is it possible to improve this system to remove the old version, in case a new download occurs due to the presence of a new version of PowerRun on the server.
    So, user don't need to uninstall and then reinstall in the case of new version.

    What do you think about this?


    EDIT: You told me that you dont have enabled BITS. So, nevermind.
     
  13. freddie-o

    freddie-o MDL Expert

    Jul 29, 2009
    1,571
    2,615
    60
    Does this work for you?
    Would be great to have a working script
    And add it to
    Code:
    HKCR\Directory\shell
    HKCR\Directory\background\shell
    HKCR\Drive\shell
    So the command prompt is accessible everywhere
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. retest

    retest MDL Member

    Nov 2, 2010
    116
    63
    10
    #114 retest, Jul 31, 2024
    Last edited: Jul 31, 2024
    Yes, it works. You will have to convert the reg code to bat code. Should be easy.

    I use AutoIt so I cannot post the code.

    This is the entire reg key, you will have to modify it a bit. Same code for Drive & Background.

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\shell\Command Prompt here as TI\shell\35Command Prompt here as TI]
    @="use PowerRun"
    "MUIVerb"="use PowerRun"
    "Icon"="\"C:\\Portable Programs\\RunAsTI\\PowerRun64.exe\", 0"
    
    [HKEY_CLASSES_ROOT\Directory\shell\Command Prompt here as TI\shell\35Command Prompt here as TI\command]
    @="\"C:\\Portable Programs\\RunAsTI\\PowerRun64.exe\" cmd.exe /s /k pushd \"%V\" & Title CMD as TI"
    

    using RegConverter https://www.sordum.org/8478/reg-converter-v1-2/
    :
    Code:
    Title Reg Converter v1.2 & Color 1A
    
    
    
    Reg.exe add "HKCR\Directory\shell\Command Prompt here as TI\shell\35Command Prompt here as TI" /ve /t REG_SZ /d "use PowerRun" /f
    Reg.exe add "HKCR\Directory\shell\Command Prompt here as TI\shell\35Command Prompt here as TI" /v "MUIVerb" /t REG_SZ /d "use PowerRun" /f
    Reg.exe add "HKCR\Directory\shell\Command Prompt here as TI\shell\35Command Prompt here as TI" /v "Icon" /t REG_SZ /d "\"C:\Portable Programs\RunAsTI\PowerRun64.exe\", 0" /f
    Reg.exe add "HKCR\Directory\shell\Command Prompt here as TI\shell\35Command Prompt here as TI\command" /ve /t REG_SZ /d "\"C:\Portable Programs\RunAsTI\PowerRun64.exe\" cmd.exe /s /k pushd \"%%V\" & Title CMD as TI" /f
    Exit
    EDIT : I got it from here : https://github.com/mspaintmsi/superUser/issues/12
     
  15. freddie-o

    freddie-o MDL Expert

    Jul 29, 2009
    1,571
    2,615
    60
    #115 freddie-o, Jul 31, 2024
    Last edited: Aug 1, 2024
    (OP)
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. Thanks guys, is now next to 'Run as Admin' here :). And Part of my REG-Skript. Doggie ist thankfull!!!
     
  17. BTW: Instead of explicit Reg-Keys i use:
    Code:
    reg add "HKCR\*\shell\Run as TrustedInstaller" /ve /t REG_SZ /d "Run as TrustedInstaller" /f
    reg add "HKCR\*\shell\Run as TrustedInstaller" /v "Icon" /t REG_SZ /d "imageres.dll,208" /f
    reg add "HKCR\*\shell\Run as TrustedInstaller\command" /v "" /t REG_EXPAND_SZ /d "cmd.exe /X /D /U /R for %%%%# in (\"%%1\") do PowerRun_x64.exe \"/WD:%%%%~dp#\" \"%%1\"" /f >nul 2>&1
    The \*\shell will install to all keys with \shell

    REG_EXPAND_SZ is found, can't remember where ...
     
  18. I have a nifty tool from @wtarkan that converts REG >> CMD. I use it for picky Reg strings -- export it as REG directly -- convert and check CMD, it will show, how it should look.

    #NIFTY
     
  19. retest

    retest MDL Member

    Nov 2, 2010
    116
    63
    10
    #119 retest, Jul 31, 2024
    Last edited: Jul 31, 2024
    @freddie-o

    There is a difference between my code and yours.

    With my code if I right-click folder 'C:\Portable Programs\Notepad2' and click 'open command prompt here as ti", the command window is opened and CDed to 'C:\Portable Programs\Notepad2'. So I can run notepad2.exe from the command window without having to manually CD to 'C:\Portable Programs\Notepad2'.
    That's why the menu item has a "here".

    With your code the command window will open at system32, I think.
     
    Tool is in maintenance so no push so far ;).