I want to copy a self made string to the clipboard using a batch-file.
My try...
set X=git log --pretty=format:"%h %ai" -n <commit>
set Y="and something else"
set "XY=%x% some other characters %Y%"
echo %XY%| clip
...failed :(
My big problem is, that I have no idea how this could be done.
set X=git log --pretty=format:"%h %ai" -n <commit>
Output should be
27fdvvd <Date> some other characters and something else
SOLUTION: Finally, I got that to work:
set BRANCHNAME=great_branch
for /f "tokens=* USEBACKQ" %%a in (`git log --pretty^=format:"%%h %%ai" -1 <commitSHA>`) do (SET COMMIT_INFO=%%a)
ECHO %COMMIT_INFO% on %BRANCHNAME% | clip
Output/Clipboard content:
<shortSHA> 2019-08-22 15:26:30 +0200 on great_branch
Thanks to all for their patience :)