Chaining commands in the button bar

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Thany
Senior Member
Senior Member
Posts: 293
Joined: 2003-09-30, 09:20 UTC
Location: Netherlands

Chaining commands in the button bar

Post by *Thany »

I was trying to put two commands behind one button in the button bar, by entering a command like so:

Code: Select all

git push & pause
When I enter this command from a plain command prompt, it works as excepted: it performs a push on git, and then executes the pause command. So far so good. When I enter just the "git push" part for a button on the button bar, it works fine. Only when chaining the two commands like above, it won't work.

Unfortunately, the command prompt pops up for a fraction of a second, and I don't know how I can keep it visible. It does seem to display a message. something with "fatal" in it (I hope it's not lethal :)). I thought of making a simpe batch file to do this, but it will make trouble for the git command, since it depends on the working directory. And afaik, in a batch file the working directory is always the physical location of the batch file. Apart from that, it feels like a workaround.

Can we somehow get this command chaining to work from TC without having to make a batch file?
User avatar
white
Power Member
Power Member
Posts: 6014
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Chaining commands in the button bar

Post by *white »

Thany wrote:I was trying to put two commands behind one button in the button bar, by entering a command like so:

Code: Select all

git push & pause
When I enter this command from a plain command prompt, it works as excepted: it performs a push on git, and then executes the pause command. So far so good. When I enter just the "git push" part for a button on the button bar, it works fine. Only when chaining the two commands like above, it won't work.
The chaining operator "&" and pause command are part of the command interpreter (Cmd.exe). A button command does a Windows Run. Your command line also does not work when using Windows Run.

Solution: Add command interpreter

Code: Select all

cmd /c git push & pause
Thany wrote:And afaik, in a batch file the working directory is always the physical location of the batch file.
It is not. Simply clear the Start path when making a button for the batch file.
Thany
Senior Member
Senior Member
Posts: 293
Joined: 2003-09-30, 09:20 UTC
Location: Netherlands

Post by *Thany »

Wow, so simple. It works :)
Total Commander 11 on Windows 10
Post Reply