Question: I want to create .reg file that fill add menu item in the windows contex menu that will pass selected item name to the cmd 

* for example avast antivirus writes smth like that in context menu:
Scan %selected\_file\_name%
* My aim to add contex menu item that fill pass item name to the console for the command
adb install -r %selected\_file\_name%

> 
> 
> ```
>    Windows Registry Editor Version 5.00
> 
>    [HKEY_CLASSES_ROOT\apk_auto_file\shell\Setup build...\command] 
>    @="cmd.exe"
> 
> ```
> 
> 

dont know how to pass it

Answer: 
Learn by example(s): next two scenarios show different ways how-to open ˙.vbs˙ file using `CScript.exe`. My default setting leads to run a `.vbs` file using `WScript.exe` on double click:

```
==> assoc .vbs
.vbs=VBSFile

==> ftype VBSFile
VBSFile="%SystemRoot%\System32\WScript.exe" "%1" %*

```

* `Open3` registry key: run VB script and keep current `cmd` window open: see `/K` switch;
* `Open4` registry key: run VB script, pause until a key pressed and then close current `cmd` window: see `/C` switch.

Used fully qualified paths to `cmd.exe` as well as to `CScript.exe` to show proper escaping `\` backslashes in paths and proper escaping inner `"` double quotes.

Query for `Open3` registry key:

```
==> reg query "HKCR\VBSFile\Shell\Open3" /s

HKEY_CLASSES_ROOT\VBSFile\Shell\Open3
    (Default)    REG_SZ    CScript && stay open

HKEY_CLASSES_ROOT\VBSFile\Shell\Open3\Command
    (Default)    REG_SZ    "C:\Windows\System32\cmd.exe" /S /K " "C:\Windows\System32\CScript.exe" "%1" "

```

and corresponding `Open3.reg` file:

```
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open3]
@="CScript && stay open"

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open3\Command]
@="\"C:\\Windows\\System32\\cmd.exe\" /S /K \" \"C:\\Windows\\System32\\CScript.exe\" \"%1\" \""

```

Query for `Open4` registry key:

```
==> reg query "HKCR\VBSFile\Shell\Open4" /s

HKEY_CLASSES_ROOT\VBSFile\Shell\Open4
    (Default)    REG_SZ    CScript && pause && close

HKEY_CLASSES_ROOT\VBSFile\Shell\Open4\Command
    (Default)    REG_SZ    "C:\Windows\System32\cmd.exe" /S /C " "C:\Windows\System32\CScript.exe" "%1" & pause"

```

and corresponding `Open4.reg` file:

```
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open4]
@="CScript && pause && close"

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open4\Command]
@="\"C:\\Windows\\System32\\cmd.exe\" /S /C \" \"C:\\Windows\\System32\\CScript.exe\" \"%1\" & pause\""

```
final result that works for me

```
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\apk_auto_file\shell\Build setup\] 
"MUIVerb"="Установить билд..."
"Icon"="imageres.dll,25"

[HKEY_CLASSES_ROOT\apk_auto_file\shell\Build setup\command\]
@="cmd.exe \"%1\" /S /K adb install -r \"%1\" "

```