在Windows命令提示符下将行复制到剪贴板

时间:2014-01-27 16:34:05

标签: cmd command prompt vanity

@echo off
cd C:\Users\"%username%"\Downloads\vanity\gen
@echo off
set /p Address=""
vanitygen -X 0 1%Address%
@echo off
for /f "tokens=2" %%a in ('vanitygen 1%Address% ^| findstr Privkey ') do echo %%a|clip
msg "%username%" Generation complete! Your private address has been copied to your clipboard!
PAUSE

此代码有效,但不是复制privaddress,而是再次运行脚本,并复制该代码。我需要它来复制第一个结果,而不是第二个结果,因为它们都会有所不同。可以做些什么来使它只复制显示的那个?

1 个答案:

答案 0 :(得分:1)

@echo off
for /f "tokens=2" %%a in ('vanitygen 1%Address% ^| findstr Privkey ') do echo %%a|clip&GOTO DONE
:DONE
msg "%username%" Generation complete! Your private address has been copied to your clipboard!
PAUSE

很难弄明白你的意思是“它再次运行 脚本” - 你没有说明vanitygen是什么,但如果字符串Privkey出现的次数超过一旦输出,这个改变应该解决问题。