如何在粘贴文本时自动执行 cmd bat 文件以执行命令?

How to automate cmd bat file to execute command as we paste text?

我在这里使用 wget。我想要做的是在粘贴到 cmd 时获取 links,这样我就可以轻松地不使用我希望 wget 获取的 links 重写每一行。

获取网站link数据的common/simple代码(批量)是"wget "http://example.com/example" --no-check-certificate""wget http://example.com/example --no-check-certificate"(都在.bat中工作), 但我希望它像 "wget %paste --no-check-certificate" 这样,如果我在命令提示符中粘贴 link 说 https://google.com,它直接 运行s 就是 "wget "https://google.com" --no-check-certificate"。 我如何实现它?

我已经尝试使用代码 wget "http://example.com/example" --no-check-certificate 正常的批处理文件脚本,没有别的。

此代码在 .bat 文件中完美运行:

wget "http://example.com/example" --no-check-certificate

我用简单的步骤解释了我的查询:

  1. 我需要一段用于批处理文件的代码,它将 运行 cmd 并将其置于待命状态,即准备好执行代码。
  2. 我将通过右键单击 > 粘贴方法粘贴 links。
  3. 我希望 bat file/cmd 执行代码,其中 link 嵌入为 wget http://example.com/example --no-check-certificate,其中 http://example.com/example 是我在 cmd 中粘贴的 link。

执行以下批处理脚本。

@echo off
:loop
set /p "link=Paste Link "
wget "%link%" --no-check-certificate
goto :loop

set /p 用于用户输入。它还接受 "paste".