Autorun.inf: how to get a drive letter?

I added this entry to the context menu of the USB drive via autorun.inf:

[AutoRun]
shell\pageant=Activate SSH Key
shell\pageant\command=PuTTY\pageant.exe PuTTY\davids.ppk

Both PuTTY\pageant.exeand PuTTY\davids.ppkare the files on the USB-stick and have to be picked up from there.

When I run it in a shell from the stick root, it works as intended. But, starting with the menu, it tries to load the key from C:\Windows\system32\PuTTY\davids.ppk( Process Monitor is marked ).

Trying to use a simple cmd script led to this conclusion:

    C: \ Windows \ system32> cd PuTTY
    Das System kann den angegebenen Pfad nicht finden.

    C: \ Windows \ system32> pageant.exe davids.ppk
    Der Befehl "pageant.exe" ist entweder falsch geschrieben oder
    konnte nicht gefunden werden.

? , , , . , .

+3
2

, . - activatekey.cmd :

REM switch to the directory containing this script
for %%a in (%0) do cd /D %%~da%%~pa

cd PuTTY
pageant.exe davids.ppk

activatekey.cmd USB- autorun.inf

[AutoRun]
shell\pageant=Activate SSH Key
shell\pageant\command=activatekey.cmd
+3

, "".:( , .: - (

1: VB script.

2: , , . .

3: script. .

Dim  oDrive
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
For Each oDrive In oFSO.Drives
WScript.Echo "Drive Letter" , oDrive.DriveLetter
WScript.Echo "Drive Type" , oDrive.DriveType
Next

, USB-.

+1

Source: https://habr.com/ru/post/1707665/


All Articles