我正在尝试捕获用户输入并将其添加到特定文本,该文本将被发送到剪贴板。
@echo off set /p TICKETID="Enter Ticket #: "
echo Here is the ticket for you, thanks : %TICKETID%
pause & ECHO |Here is the ticket for you, thanks : %TICKETID%| CLIP
这行不通,我尝试了其他方法来编码,例如:
@echo off
set /p userInput="Enter Ticket #: "
REM Get current clipboard content
for /f "usebackq delims=" %%I in (`powershell -command "Get-Clipboard"`) do set "clipboardContent=%%I"
REM Define the phrase in clipboard
set "phrase=Here is the ticket for you, thanks:"
REM Combine user input with the phrase
set "newClipboardContent=%clipboardContent% %phrase% %userInput%"
REM Set the new content back to clipboard
echo %newClipboardContent% | clip
这个也没有做到。
我也尝试过:
@echo off
SET /P variable=Enter ticket # :
echo Here is a ticket for you %variable% | CLIP
有人有建议吗?
这是实现您目标的简单方法:
@echo off
Set /p TICKETID="Enter Ticket #: "
echo Here is the ticket for you, thanks : %TICKETID%
echo Here is the ticket for you, thanks : %TICKETID% | CLIP
echo Copied to the clipboard
pause