Jump to content
Sign in to follow this  
youtuber

Find Right click location of file?

Recommended Posts

How do I find the location of the files I'm right-clicking?

regadd.au3

#RequireAdmin
$aDirPro = @ProgramFilesDir & "\Parameter pending program"
RegWrite('HKCR\*\shell\Send parameters to this CmdLine.exe -1\command', '', 'REG_SZ','"' & $aDirPro & '\CmdLine.exe" " -1"')
RegWrite('HKCR\*\shell\Send parameters to this CmdLine.exe -2\command', '', 'REG_SZ','"' & $aDirPro & '\CmdLine.exe" " -2"')

CmdLine.au3

If $CmdLine[0] = 0 Then Exit MsgBox(16, "Error", "No parameters")

If $CmdLine[1] = "-p1" Then
ShellExecute(@ScriptDir & "\Parameter pending program.exe", " -1 " & find Right click location of file?)
EndIf

If $CmdLine[1] = "-p2" Then
ShellExecute(@ScriptDir & "\Parameter pending program.exe", " -2 " & find Right click location of file?)
EndIf

 

Edited by youtuber

Share this post


Link to post
Share on other sites

Use %1 example:

  • Save this Script as Commands.au3
  • Compile as Commands.exe
  • Run: Commands.exe --Install
    nb: This adds the registry items for all files
  • You should now be able to right click any file and get the path.

PS:

  • Run: Commands.exe --Uninstall (if you want to uninstall)
#RequireAdmin
#NoTrayIcon

If _CmdLine_Exists("Install") Then
    RegWrite('HKCR\*\shell\Send parameters to this CmdLine.exe -1\command', '', 'REG_SZ','"' & @ScriptFullPath & '" -1 "%1"')
    RegWrite('HKCR\*\shell\Send parameters to this CmdLine.exe -2\command', '', 'REG_SZ','"' & @ScriptFullPath & '" -2 "%1"')
    Exit
ElseIf _CmdLine_Exists("Uninstall") Then
    RegDelete('HKCR\*\shell\Send parameters to this CmdLine.exe -1')
    RegDelete('HKCR\*\shell\Send parameters to this CmdLine.exe -2')
    Exit
EndIf

Global $g_sCmdLine
If _CmdLine_Exists("1") Then
    $g_sCmdLine = _CmdLine_SwitchValue("1")
    If $g_sCmdLine = Null Then Exit MsgBox(4096, "CmdLine 1", "CmdLine 1 - Null Value")
    MsgBox(4096, "CmdLine 1", $g_sCmdLine)
ElseIf $g_sCmdLine = _CmdLine_SwitchValue("2") Then
    If $g_sCmdLine = Null Then Exit MsgBox(4096, "CmdLine 2", "CmdLine 2 - Null Value")
    MsgBox(4096, "CmdLine 2", $g_sCmdLine)
EndIf

Func _CmdLine_SwitchValue($sCmdLine, $vResult = Null)
    For $i = 1 To $CmdLine[0]
        If $CmdLine[$i] = "/" & $sCmdLine Or $CmdLine[$i] = "-" & $sCmdLine Or $CmdLine[$i] = "--" & $sCmdLine Then
            If $CmdLine[0] >= $i + 1 Then
                If StringLeft($CmdLine[$i + 1], 1) = "/" Or StringLeft($CmdLine[$i + 1], 1) = "-" Or StringLeft($CmdLine[$i + 1], 2) = "--" Then
                    Return $vResult
                Else
                    Return $CmdLine[$i + 1]
                EndIf
            EndIf
        EndIf
    Next
    Return $vResult
EndFunc

Func _CmdLine_Exists($sCmdLine)
   For $i = 1 To $CmdLine[0]
      If $CmdLine[$i] = "/" & $sCmdLine Or $CmdLine[$i] = "-" & $sCmdLine Or $CmdLine[$i] = "--" & $sCmdLine Then
         Return True
      EndIf
   Next
   Return False
EndFunc

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...