When I am on the command line and do this:
"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:log
a GUI dialog of TortoiseGit is opened and cmd.exe immediately returns, meaning that I can immediately run other commands like dir
etc.
Because the aforementioned command is quite long, I created a helper batch file, tgit.cmd, that contains just this:
@echo off
"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %*
I can now call just tgit log which is great, however, there is one difference: the command-line is blocked until I close the TortoiseGit dialog.
I have also tried
cmd /C "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %*
but that doesn't make any difference. How to immediately return from the batch file?
The answer from Oscar is almost correct, but needs a correction
start "" "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %*
Why?
start
command has a curious behaviour: the first quoted argument is used to determine the title of a new cmd
window, and no, it doesn't matter that no cmd
window will be started. First quoted argument is the title.
That is the reason for the empty double quotes in the previous code. Without it, what the start
command sees is
start "title=c:\Progra..." /command:....
and as the start
command does not include a /command
switch, it fails.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With