There is a variable that contains the path of the file with the parameter, you need to remove the parameter, there was an attempt in For to use delims, but it excludes not the word itself, but the specified letters. In Js there is a split command, what to use in bat cases? There is such code:

@echo off For /F "UseBackQ Tokens=3*" %%I In (`Reg Query "HKEY_USERS\.DEFAULT\Software\Classes\steam\Shell\Open\Command"^|Find /I "steam.exe"`) Do set steam=%%J echo %steam% pause 

In the meaning of steam, besides the path itself, there remains "% 1", how to get rid of it? te

    1 answer 1

    After reading the variable from the registry, you need to extract all the characters before the double quote. It is done in 2 steps. We read the value in the variable % b% , getting rid of quotes around the edges. Then we process it.

     @for /f "tokens=3* skip=2" %%i in ('@Reg Query HKEY_USERS\.DEFAULT\Software\Classes\steam\Shell\Open\Command') do @set b=%%~j @for /f tokens^=1-2^ delims^=^" %%a in ("%b%") do @echo %%a 
    • In general, I would recommend using the where utility to find the path to the executable file if the program was installed correctly. For example: where steam - Daemon-5