Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Translate be.exe scrpt to TCC

Hello,
I have since many years a batch file with be.exe, which make every weekday a separate backup of my outlook.pst. I now switched to a 64bit system and my script doesn't run anymore.
I would be very glad, if someone can help me to translate my script to TCC.
Her is the old script:

------
%windir%\system32\be.exe delay 100
%windir%\system32\be.exe WEEKDAY /Debug

if errorlevel 7 goto Sa
if errorlevel 6 goto Fr
if errorlevel 5 goto Do
if errorlevel 4 goto Mi
if errorlevel 3 goto Di
if errorlevel 2 goto Mo
if errorlevel 1 goto So
echo Copy Error
pause
goto ende

:Mo
set weekday=Mo
goto weiter
:Di
set weekday=Di
goto weiter
:Mi
set weekday=Mi
goto weiter
:Do
set weekday=Do
goto weiter
:Fr
set weekday=Fr
goto weiter
:Sa
set weekday=Sa
goto weiter
:So
set weekday=So
goto weiter

:weiter
rd "h:\!outlook\%weekday%" /S /Q
md h:\!outlook\%weekday%
md h:\!outlook\%weekday%\moony
copy "%systemdrive%\Dokumente und Einstellungen\%username%\Lokale Einstellungen\Anwendungsdaten\Microsoft\Outlook\o*.*" "h:\!outlook\%weekday%\"

--------------

Greeting
summergames
 
Try this
Code:
:: _dow = Wochetag auf englisch, weekday = tag auf deutsch.
if z%_dow==zSun set weekday=So
if z%_dow==zMon set weekday=Mo
if z%_dow==zTue set weekday=Di
if z%_dow==zWed set weekday=Mi
if z%_dow==zThu set weekday=Do
if z%_dow==zFri set weekday=Fr
if z%_dow==zSat set weekday=Sa
:weiter
rd "h:\!outlook\%weekday%" /S /Q
md h:\!outlook\%weekday%
md h:\!outlook\%weekday%\moony
copy "%systemdrive%\Dokumente und Einstellungen\%username%\Lokale Einstellungen\Anwendungsdaten\Microsoft\Outlook\o*.*" "h:\!outlook\%weekday%\"
 
Have a look a the @IDOW function. You can skip the name conversion completely.

The new files will overwrite the existing files in the weekday dir, using the right switches,
so an RD is unnecessary.

MD can create dirs and subdirs in one go, so you can lose the first MD line.

COPY can create missing dirs, so you could probably lose the second MD line.

If the creation date of the weekday dirs is needed, have a look at the TOUCH command.

The directory MOONY seems to have no further use anyway?

You could reduce that whole batch to one, max two commands with TCC.
 
Last edited:
Try this
Code:
:: _dow = Wochetag auf englisch, weekday = tag auf deutsch.
if z%_dow==zSun set weekday=So
if z%_dow==zMon set weekday=Mo
if z%_dow==zTue set weekday=Di
if z%_dow==zWed set weekday=Mi
if z%_dow==zThu set weekday=Do
if z%_dow==zFri set weekday=Fr
if z%_dow==zSat set weekday=Sa
:weiter
rd "h:\!outlook\%weekday%" /S /Q
md h:\!outlook\%weekday%
md h:\!outlook\%weekday%\moony
copy "%systemdrive%\Dokumente und Einstellungen\%username%\Lokale Einstellungen\Anwendungsdaten\Microsoft\Outlook\o*.*" "h:\!outlook\%weekday%\"
 
Danke für die Scriptübersetung. Ich habe mich bestimmt seit 15 Jahren nicht mehr mit so etwas beschäftigt, daher bin ich jetzt wieder ein Anfänger auf dem Gebiet.
Wie binde ich denn das Script ein? Bisher war es ein *.bat file.

Mache ich aus dem Script ein Textfile bspw. "test.txt" und rufe das dann über "TCC.exe test.txt" auf oder wie funktioniert das mit diesem Programm?

Sicherlich kann man, wie im zweiten Kommentar beschrieben, das Script kürzen, nur da ich das Programm überhaupt nicht kenne und eigentlich nur dieses eine Script benötige, habe ich mich noch gar nicht in die Möglichkeiten eigearbeitet.

Auf jeden Fall schon einmal Danke an beide Hilfestellungen.

Mit freundlichen Grüßen
summergames
 
Korrektur: Läuft nur zur Hälfte:

Wenn ich den Batch manuell starte, funktioniert alles prima, das Unterverzeichnis mit dem Wochentagskürzel wird angelegt ("!Outlook\Fr") und dahinein wird die pst-Datei kopiert.
Wenn ich diesen Batch jedoch beim Anmelden automatisch über die Windows-Aufgabenplanung starte, wird das Wochentagsverzeichnis nicht angelegt und die pst-Datei in das übergeordnete Verzeichnis ("!Outlook") kopiert.

Was muss ich noch ändern?
MfG
summergames
 
Try again with this single line commands:

copy /MD/U/Q/Y "%systemdrive%\Dokumente und Einstellungen\%username%\Lokale Einstellungen\Anwendungsdaten\Microsoft\Outlook\o*.*" "h:\!outlook\%@idow[%_date]"

Save your batch with a BTM extension. Your BAT files are probably still executed by CMD.COM, which knows nothing about TCC commands and variables.

Make sure your BTM files are executed by TCC, normally this is done automatically during installation of TCC or TCMD.

Try again.

To get more help, let's to keep this conservation in English.
 
Last edited:
Hello,

the single line command:

copy /MD/U/Q/Y "%systemdrive%\Dokumente und Einstellungen\%username%\Lokale Einstellungen\Anwendungsdaten\Microsoft\Outlook\o*.*" "h:\!outlook\%@idow[%_date]"

only works, if the directory with the name of the weekday already exists. If not, it don't work: The line then don't create a directory with the name of the weekday and copy the files o*.* but create a new file with the name of the weekday.

So I have first to create all weekday directories in the script so make sure that it always work.

After execution of the script with the windows task manager the script stays open. Is there any command that the script closes itself? The command "quit" don't work.

Kind regards
summergames
 
The copy command will work if you change it to :

Code:
copy /MD /U /Q /Y "%systemdrive%\Dokumente und Einstellungen\%username%\Lokale Einstellungen\Anwendungsdaten\Microsoft\Outlook\o*.*" "h:\!outlook\%@idow[%_date]"\

Notice the "\" at the end. The help says: "Create the target directory if it doesn't exist. Note that you *must* either terminate the target directory name with a trailing \ or specify a filename component; otherwise COPY cannot tell what you want for the directory and what you want for the filename." so I always use "\" to specify I want a directory.
 
SOLVED!!! :smile:

Thank you to all, who give me such a good assistance.
Here I write a summary, that perhaps help other users.

Problem:
I want to make a cycling backup of my mail file. There should be a backup every day of the week, so that I have 6 backup versions.
The task should create a directory with the directory name = weekday and should then copy the mail files in the specific directory.
This task should be executed by the windows task manager.

Solution:
Install TCC and assign the file type .btm to this program

Make a file "mail.btm" with this script (change path to your requirements):

@ECHO OFF
Taskkill /im outlook.exe /F /T
copy /MD /U /Q /Y "%LOCALAPPDATA%\Microsoft\Outlook\*.*" "h:\!outlook\%@idow[%_date]"\
exit


Then make a new task in the windows task manager, at which time you want to execute the mail.btm.
That's it.

Greetings to all
summergames
 
One other comment I'd like to add. You shouldn't need the EXIT command in your script. When invoking a BTM file from the Task Scheduler, you should use the full path to TCC.EXE as the command, and the arguments should be /C scriptname.btm scriptarg1 scriptarg2 ... scriptargN.

If you have TCC installed in C:\TC21 for example, the full path is C:\TC21\TCC.EXE.
And the arguments would be: /C mail.btm
And the working directory would be wherever you have your mail.btm file.

The /C switch tells TCC to execute the command and close when complete.
 
Back
Top
[FOX] Ultimate Translator
Translate