youtuber Posted July 17, 2019 Posted July 17, 2019 (edited) 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 July 17, 2019 by youtuber
Subz Posted July 18, 2019 Posted July 18, 2019 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) expandcollapse popup#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 youtuber 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now