summaryrefslogtreecommitdiff
path: root/BUILD/Help/html/advanced/Batch Scripting.html
blob: c74367927751adf3f2069fd19f66107d9403373b (plain)
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
89
90
91
92
93
<!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.2  (Win32)">
	<META NAME="CREATED" CONTENT="20091206;16574000">
	<META NAME="CHANGED" CONTENT="20100807;21103000">
	<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 }
		H3 { margin-bottom: 0.21cm }
		H3.western { font-family: "Arial", sans-serif }
		H3.cjk { font-family: "MS Mincho" }
		H3.ctl { font-family: "Mangal" }
		A:link { so-language: zxx }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<H3 CLASS="western"><FONT FACE="Tahoma, sans-serif">Batch Scripting
<SPAN STYLE="font-weight: normal">(Windows)</SPAN></FONT></H3>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">In
order to facilitate using FreeFileSync and RealtimeSync in advanced
synchronization scenarios, creating batch files is a good way to
provide additional functionality. The following section will give
some general hints for custom *.cmd and *.bat files.</FONT></P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Example:</B>
A simple locking facility &ndash; (<SPAN STYLE="font-style: normal"><B>Note:</B></SPAN><I>
FreeFileSync already has a more powerful directory locking mechanism
implemented that allows multiple writers in parallel</I>)</FONT></P>
<UL>
	<P><SPAN ID="Rahmen5" 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="Courier New, monospace">:tryAgain<BR>if not exist
		\\share\folder\lock (<BR>&nbsp;&nbsp;</FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::create
		the lock<BR></B></I></FONT></FONT><FONT COLOR="#808080">&nbsp;&nbsp;</FONT><FONT FACE="Courier New, monospace">echo
		This is a lock file &gt; \\share\folder\lock<BR>&nbsp;&nbsp;</FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::execute
		the synchronization batch job synchronously<BR>&nbsp;&nbsp;</B></I></FONT></FONT><FONT FACE="Courier New, monospace">&quot;C:\Program
		Files\FreeFileSync\FreeFileSync.exe&quot;
		&quot;C:\MySyncJob.ffs_batch&quot;<BR>&nbsp;&nbsp;del
		\\share\folder\lock<BR>) else (<BR>&nbsp;&nbsp;</FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::wait
		5 seconds then try starting sync again:<BR></B></I></FONT></FONT><FONT COLOR="#808080">&nbsp;&nbsp;</FONT><FONT FACE="Courier New, monospace">choice
		/C:AB /T:5 /D:A &gt; NUL<BR>&nbsp;&nbsp;goto tryAgain<BR>)</FONT></P>
	</SPAN><BR CLEAR=LEFT>
	</P>
</UL>
<OL>
	<P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"><FONT COLOR="#808080">&nbsp;</FONT></P>
	<LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">When
	starting a batch file from RealtimeSync be sure to make synchronous
	calls to FreeFileSync only. This will prevent RealtimeSync from
	detecting changes while synchronization is still in progress.</FONT></P>
	<P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"><FONT COLOR="#808080">&nbsp;</FONT></P>
	<LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">During
	execution of a Batch file a black console window is shown. You can
	hide this window by using the Visual Basic script &quot;Invisible.vbs&quot;
	located in the FreeFileSync installation directory.</FONT></P>
	<P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif"><B>Usage:</B></FONT></P>
	<P ALIGN=LEFT STYLE="margin-right: 0.98cm; margin-bottom: 0cm"><SPAN ID="Rahmen7" 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="Courier New, monospace">wscript C:\Program
		files\FreeFileSync\Invisible.vbs C:\MyBatchFile.cmd</FONT></P>
	</SPAN><BR CLEAR=LEFT><FONT COLOR="#808080">&nbsp;</FONT> 
	</P>
</OL>
<OL START=3>
	<LI><P STYLE="margin-bottom: 0cm"><FONT FACE="Tahoma, sans-serif">FreeFileSync
	returns with an Errorlevel below zero if unresolved problems remain:</FONT></P>
	<P><SPAN ID="Rahmen1" 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="Courier New, monospace">&quot;C:\Program
		Files\FreeFileSync\FreeFileSync.exe&quot;
		&quot;H:\Silent_Config.ffs_batch&quot;<BR>if not errorlevel 0
		(<BR>&nbsp;&nbsp;</FONT><FONT COLOR="#808080"><FONT FACE="Courier New, monospace"><I><B>::if
		something went wrong, add special treatment here<BR></B></I></FONT></FONT><FONT COLOR="#000000">&nbsp;&nbsp;</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>&nbsp;&nbsp;<FONT FACE="Courier New, monospace">pause<BR>)</FONT></P>
	</SPAN><BR CLEAR=LEFT>
	</P>
</OL>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
</BODY>
</HTML>
bgstack15