Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 180 Vote(s) - 3.59 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to run a command from a batch file and immediately return?

#1
When I am on the command line and do this:

"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:log

a GUI dialog of [TortoiseGit][1] 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?

[1]:

[To see links please register here]

Reply

#2
Use START to run the command.

start "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" "/command:log"
Reply

#3
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.


Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through