繁体   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