문제

My batch script contains this code:

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git fetch -q --all -p"

When I run it by double clicking, or when started by the task scheduler it wont close the window after it's done. I've tried Start "" "C:..., Exit 0, cmd \c,GOTO :EOF and nothing seems to work.

도움이 되었습니까?

해결책 2

For some reason calling using C:\Program Files (x86)\Git\bin\sh.exe leads to two ssh-agent.exe processes that won't stop even after calling exit. So my solution was to instead use the git command which calls C:\Program Files (x86)\Git\cmd\git.exe and does not leave ssh-agent.exe processes running and allows the command window to close.

다른 팁

I believe it's because you're opening a window which is calling sh.exe, opening it in another window. There is nothing to tell that window the close after the first one does.

Try adding & exit to the end of your git command.

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git fetch -q --all -p & exit"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top