Bat file as a button, how to setup Start Path (SOLVED)

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Dwhite
Junior Member
Junior Member
Posts: 8
Joined: 2019-11-19, 10:58 UTC

Bat file as a button, how to setup Start Path (SOLVED)

Post by *Dwhite »

I have a bat file which can batch covert SVG to PNG.

Normal Way:
I can move it to the desire folder(contains SVG file) eg. D:\svg\ then launch the bat file. ---it works.
But I don't wanna always have to move that bat file to the desire folder with SVG, so I tried to create a button.

TC Way:
1. I just drag the bat file to the toolbar. I only changed the Start Path to %P. ---When I navigated to the desire folder on TC then click the button, it failed.
2. While if I changed the Start Path to exactly D:\svg\, the I navigated to a random folder on TC, it works(Of course it works, I know)

But why %P doesn't work? And how to make it(TC Way 1) works?? :?

Thanks in advance.
Regards
Last edited by Dwhite on 2020-04-07, 12:04 UTC, edited 1 time in total.
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3864
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Re: Bat file as a button, how to setup Start Path

Post by *sqa_wizard »

Using a start path means: all filenames without path are used at this start path or the folders at PATH environment.
If your batch file starts a program (e.g. the converter) or uses a file (e.g. the file to convert) you have use a notation with path.
#5767 Personal license
User avatar
Hacker
Moderator
Moderator
Posts: 13065
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Bat file as a button, how to setup Start Path

Post by *Hacker »

Dwhite,
Try leaving the start path empty.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Dwhite
Junior Member
Junior Member
Posts: 8
Joined: 2019-11-19, 10:58 UTC

Re: Bat file as a button, how to setup Start Path

Post by *Dwhite »

@sqa_wizerd
OK got it.

@Hacker
Yeah, it works!

thank you.
User avatar
nsp
Power Member
Power Member
Posts: 1805
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Bat file as a button, how to setup Start Path

Post by *nsp »

Out of Topic
Drag'n Drop is not the best way to work with button in TC because all the parameters are replaced by the first selected file full path name..

Start path only accept full path definition none of the %P %T are interpreted ..

If you use a lot your bat file with D'nD, you should make it more robust and make it works from anywhere using only full name as single parameter.

From a parameter inside your bat file, you can use %~dp1 to get full path of the parameter file and cd /d "%~dp1" to go to the file folder...
Dwhite
Junior Member
Junior Member
Posts: 8
Joined: 2019-11-19, 10:58 UTC

Re: Bat file as a button, how to setup Start Path (SOLVED)

Post by *Dwhite »

thx for the tips
Post Reply