How to integrate TC button parameter_%s with DOS_Batch file ?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Tangent Lin
Junior Member
Junior Member
Posts: 16
Joined: 2005-03-13, 04:52 UTC

How to integrate TC button parameter_%s with DOS_Batch file ?

Post by *Tangent Lin »

1.Some dirs with old date in the d:\work_dir .

2.There is no cloud_service can keep the uploaded dirs' ori_timestamp.

3.With the topic about keeping the timestamp of the backuping up dirs , I can get the Dos_batch file and named as bk.bat.
https://stackoverflow.com/questions/50422950/how-to-create-a-rar-archive-with-date-of-the-archived-folder-in-archive-file-nam?answertab=votes#tab-top
===>bk.bat

Code: Select all

@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "FolderToBackup=%1"

rem Get last modification date/time of the folder to backup
rem in region dependent format which is YYYY-MM-DD hh:mm.
for %%I in ("%FolderToBackup%") do set "FolderTimeStamp=%%~tI"

rem Get from this date/time string just the year, month
rem and day of month from the date without the hyphens.
set "FolderTimeStamp=%FolderTimeStamp:~0,4%%FolderTimeStamp:~5,2%%FolderTimeStamp:~8,2%"

rem Compress the folder to backup into a RAR archive file with
rem last modification date of folder used in archive file name.
"%Programw6432%\WinRAR\WinRAR.exe" a -ac -cfg- -dh -ep1 -ibck -m4 -oh -ol -os -ow -r -ts -y -- %FolderTimeStamp%_%FolderToBackup%.rar "%FolderToBackup%"

rem Restore the environment as set before usage of command SETLOCAL at top.
endlocal
4.I changed a button in the button bar with bk.bat in command field , and %s in parameters field .
https://s1.ax1x.com/2018/11/03/i4TDsO.jpg

5.The button_[bk.bat] worked successfully for one dir .
https://s1.ax1x.com/2018/11/03/i47u0e.jpg

6.When I select 2 more dirs , the button_[bk.bat] only deal with the first dir and do nothing with the rest .

How should I deal with this situation ?
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Re: How to integrate TC button parameter_%s with DOS_Batch file ?

Post by *Ovg »

Change your cmd file according to viewtopic.php?p=264686#p264686
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
Tangent Lin
Junior Member
Junior Member
Posts: 16
Joined: 2005-03-13, 04:52 UTC

Re: How to integrate TC button parameter_%s with DOS_Batch file ?

Post by *Tangent Lin »

Ovg wrote: 2018-11-03, 10:28 UTC Change your cmd file according to viewtopic.php?p=264686#p264686
The .bat file can not deal with the "D:\doc\aatemp\" style directories strings sent by TC with %L parameter .
The dirs strings should be in "D:\doc\aatemp" style.
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Re: How to integrate TC button parameter_%s with DOS_Batch file ?

Post by *Ovg »

Tangent Lin wrote: 2018-11-03, 13:05 UTC The .bat file can not deal with the "D:\doc\aatemp\" style directories strings sent by TC with %L parameter .
The dirs strings should be in "D:\doc\aatemp" style.
AHK script to remove trailing \ in names

Code: Select all

If (%0% > 0)
{
  tmp = %1%
  fList := FileOpen(tmp,"r","UTF-8")
  mList := fList.Read()
  mList := RegExReplace(mList,"\\\R","`r`n")
  mList := RegExReplace(mList,"\\$","")
  fList.Close()
  FileDelete, %tmp%
  FileAppend, %mList%, %tmp%, UTF-8
}
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
Post Reply