簡體   English   中英

通過 OpenWith 下拉菜單將文件傳遞到命令提示符

[英]pass a file to command prompt by OpenWith dropdown menu

好吧,有一個名為 QRCP 的應用程序可以通過二維碼通過局域網共享文件。 它使用 cmd 中的命令來共享文件:

qrcp幫助

我想將它添加到 SendTo 下拉菜單,但問題是我無法將我想要共享的文件傳遞給它。

我需要這樣的東西:

捷徑

我可以用%1傳遞文件位置,最后的命令應該是
qrcp send "D:\Program Files\file.exe"

但它似乎不是它的工作原理!

這是我在我這邊試過的一個例子。

這個批處理文件可以在SendTo文件夾上創建一個快捷方式,也可以為你做這個技巧,只需更改你這邊的 QRCP 路徑:


@echo off
Title QRCP Batch File
REM Create a shortcut on SendTo Folder
REM "Call :CreateShortcut_SendTo" - This command calls the CreateShortcut_SendTo subroutine,
REM which creates a shortcut in the SendTo folder that can be used to easily execute the script.
Call :CreateShortcut_SendTo
REM This command sets the QRCP_Path variable to the location of the QRCP.exe file in the same directory as the batch file.
Set QRCP_Path="%~dp0QRCP.exe"
Set FilePath=%1

If "%FilePath%" == "" (
    Color 0C & echo No File was passed throw this Program, Exiting ... & Timeout /T 5 /NoBreak>nul & Exit
)

%QRCP_Path% %1
echo File %1 passed to QRCP
Exit /B

::---------------------------------------------------------------------------------------------------
:CreateShortcut_SendTo
Powershell -Command "If (Test-Path '%Appdata%\Microsoft\Windows\SendTo\%~n0.lnk') { Remove-Item '%Appdata%\Microsoft\Windows\SendTo\%~n0.lnk' }"
Powershell ^
"$s=(New-Object -COM WScript.Shell).CreateShortcut('%Appdata%\Microsoft\Windows\SendTo\%~n0.lnk'); ^
$s.TargetPath='%~dpnx0'; ^
$s.WorkingDirectory='%~dp0'; ^
$s.IconLocation='%QRCP_Path%,0'; ^
$s.Save()"
Exit /B
::---------------------------------------------------------------------------------------------------

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM