1

I want to copy a self made string to the clipboard using a .

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 :)

KodJunk
  • 11
  • 3
  • Open a Command Prompt window and read the output when entering `for /?`. – Compo Aug 23 '19 at 10:28
  • @schipfl Please tell me the anwer to my question about how this could work` ``` set COMMIT_INFO="${git log --pretty=format:"%%h %%ai" -1 ceb9fab47c683e44f3bca09d03889d20025ad554}" ``` – KodJunk Aug 23 '19 at 10:36
  • "_...failed :(_" is not a problem description. What happened? Why was that wrong? – underscore_d Aug 23 '19 at 10:38
  • @KodJunk, please formulate an answer using the duplicates clearly listed at the top of the question, _which is now closed_! – Compo Aug 23 '19 at 10:45
  • @underscore_d the command has not been executed. – KodJunk Aug 23 '19 at 10:49

0 Answers0