1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.4.1 (Win32)">
<META NAME="CREATED" CONTENT="20091206;16574000">
<META NAME="CHANGED" CONTENT="20130206;19571611">
<META NAME="Info 1" CONTENT="">
<META NAME="Info 2" CONTENT="">
<META NAME="Info 3" CONTENT="">
<META NAME="Info 4" CONTENT="">
<STYLE TYPE="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
H2.cjk { font-family: "SimSun" }
H2.ctl { font-family: "Mangal" }
A:link { so-language: zxx }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<H2 CLASS="western"><FONT FACE="Tahoma, sans-serif"><FONT SIZE=4 STYLE="font-size: 15pt">Batch
Scripting</FONT></FONT></H2>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">FreeFileSync
can be called from command line and supports integration into batch
scripts. This section gives some general hints and examples for
Windows <FONT FACE="Courier New, monospace">*.cmd</FONT> and <FONT FACE="Courier New, monospace">*.bat</FONT>
scripts.</FONT></P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">When
FreeFileSync is started in batch mode (a <FONT FACE="Courier New, monospace">*.ffs_batch</FONT>
file is passed as argument) it returns one of the following status
codes:</FONT></P>
<P STYLE="margin-left: 1.46cm; margin-bottom: 0cm"><SPAN ID="Rahmen1" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: 1px solid #000080; padding: 0.05cm; background: #ccccff">
<UL>
<P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-style: normal"><B>Return
Codes</B></SPAN><SPAN STYLE="font-style: normal"><BR>0 -
Synchronization completed successfully<BR>1 - Synchronization
completed with warnings<BR>2 - Synchronization completed with
errors<BR>3 - Synchronization was aborted</SPAN></FONT></P>
</UL>
</SPAN><BR CLEAR=LEFT><BR>
</P>
<P STYLE="margin-bottom: 0cm; font-weight: normal"><FONT FACE="Tahoma, sans-serif">Now
you can check if synchronization was successful from a script:</FONT></P>
<P STYLE="margin-left: 1.32cm; margin-bottom: 0cm"><SPAN ID="Rahmen6" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: none; padding: 0cm; background: #e6e6e6">
<P ALIGN=LEFT STYLE="margin-left: 0.79cm; margin-right: 0.98cm; margin-bottom: 0cm">
<FONT FACE="Tahoma, sans-serif"><FONT FACE="Courier New, monospace">"C:\Program
Files\FreeFileSync\FreeFileSync.exe" "H:\some
folder\SyncJob.ffs_batch"<BR>if errorlevel 1 (<BR> </FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::if
return code is 1 or greater, something went wrong, add special
treatment here<BR> </B></I></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Courier New, monospace"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">echo
Errors occurred during synchronization...</SPAN></SPAN></FONT></FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B><BR> </B></I></FONT></FONT><FONT FACE="Courier New, monospace">pause<BR>)</FONT></FONT></P>
</SPAN><BR CLEAR=LEFT><BR>
</P>
<P STYLE="margin-left: 1.32cm; margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">Instead
of displaying "An error occurred!" you can also send an
email notification (using a third party tool).</FONT>
</P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-left: 1.46cm; margin-bottom: 0cm"><SPAN ID="Rahmen3" DIR="LTR" STYLE="float: left; width: 80%; height: 0.14cm; border: 1px solid #000080; padding: 0.05cm; background: #ccccff">
<P ALIGN=LEFT STYLE="margin-left: 0.79cm; margin-right: 0.98cm; margin-bottom: 0cm">
<FONT FACE="Tahoma, sans-serif"><B>Attention<BR></B>Make sure your
script is not blocked by a popup dialog. Consider the following
options when setting up a FreeFileSync batch job:</FONT></P>
<UL>
<LI><P ALIGN=LEFT STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">Disable
checkbox <SPAN STYLE="font-style: normal"><B>Show progress dialog</B></SPAN>
or have <B>On completion</B> automatically close the results dialog
after synchronization.</FONT></P>
<LI><P ALIGN=LEFT STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">Set
e</SPAN></FONT><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">rror
handling</SPAN></SPAN></FONT> <FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">to
</SPAN></FONT><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-style: normal"><B>Exit
instantly</B></SPAN></FONT> <FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">or
</SPAN></FONT><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-style: normal"><B>Ignore
errors</B></SPAN></FONT><FONT FACE="Tahoma, sans-serif"><SPAN STYLE="font-weight: normal">.</SPAN></FONT></P>
</UL>
</SPAN><BR CLEAR=LEFT><BR>
</P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
</BODY>
</HTML>
|