新建批处理--buildLinux.cmd
新建VBScript文件--Linux.vbs
附录(SecureCRT帮助):
---------------------------------------------------------------------
del E:\dailybuilder\ftpTemp\linux
SecureCRT.EXE /s "192.168.0.2" /script "E:\dailybuilder\WebSite\Tools\Linux.vbs"
copy /Y E:\dailybuilder\ftpTemp\linux E:\dailybuilder\WebSite\buildFolder\
REM Taskkill /IM SecureCRT.EXE /T
---------------------------------------------------------------------
del E:\dailybuilder\ftpTemp\linux
SecureCRT.EXE /s "192.168.0.2" /script "E:\dailybuilder\WebSite\Tools\Linux.vbs"
copy /Y E:\dailybuilder\ftpTemp\linux E:\dailybuilder\WebSite\buildFolder\
REM Taskkill /IM SecureCRT.EXE /T
---------------------------------------------------------------------
新建VBScript文件--Linux.vbs
---------------------------------------------------------------------
#$language = "VBScript"
#$interface = "1.0"
Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
If (Not crt.Screen.WaitForString("username", 8)) Then
crt.Screen.Send vbCr
crt.Screen.WaitForString "username"
End If
crt.Screen.Send "cd /home/username/Coding" & VbCr
crt.Screen.WaitForString "Coding"
crt.Screen.Send "mk -c project.plf" & VbCr
crt.Screen.WaitForString "Coding"
crt.Screen.Send "cd /home/username/Coding/product/linuxd" & VbCr
crt.Screen.WaitForString "linuxd"
crt.Screen.Send "ftp 192.168.0.1" & VbCr
crt.Screen.WaitForString "Name "
crt.Screen.Send "ftpUser" & VbCr
crt.Screen.WaitForString "Password:"
crt.Screen.Send "ftpPassword" & VbCr
'crt.Screen.WaitForString "ftp>"
'crt.Screen.Send "delete jx_linux_t" & VbCr
crt.Screen.WaitForString "ftp>"
crt.Screen.Send "put linux" & VbCr
crt.Screen.WaitForString "ftp>"
crt.Screen.Send "quit" & VbCr
crt.Screen.WaitForString "linuxd"
crt.Screen.Send "exit" & VbCr
crt.Sleep 2000
' turn off synchronous mode to restore normal input processing
crt.Screen.Synchronous = False
crt.Sleep 2000
crt.Quit
End Sub
---------------------------------------------------------------------
#$language = "VBScript"
#$interface = "1.0"
Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
If (Not crt.Screen.WaitForString("username", 8)) Then
crt.Screen.Send vbCr
crt.Screen.WaitForString "username"
End If
crt.Screen.Send "cd /home/username/Coding" & VbCr
crt.Screen.WaitForString "Coding"
crt.Screen.Send "mk -c project.plf" & VbCr
crt.Screen.WaitForString "Coding"
crt.Screen.Send "cd /home/username/Coding/product/linuxd" & VbCr
crt.Screen.WaitForString "linuxd"
crt.Screen.Send "ftp 192.168.0.1" & VbCr
crt.Screen.WaitForString "Name "
crt.Screen.Send "ftpUser" & VbCr
crt.Screen.WaitForString "Password:"
crt.Screen.Send "ftpPassword" & VbCr
'crt.Screen.WaitForString "ftp>"
'crt.Screen.Send "delete jx_linux_t" & VbCr
crt.Screen.WaitForString "ftp>"
crt.Screen.Send "put linux" & VbCr
crt.Screen.WaitForString "ftp>"
crt.Screen.Send "quit" & VbCr
crt.Screen.WaitForString "linuxd"
crt.Screen.Send "exit" & VbCr
crt.Sleep 2000
' turn off synchronous mode to restore normal input processing
crt.Screen.Synchronous = False
crt.Sleep 2000
crt.Quit
End Sub
---------------------------------------------------------------------
附录(SecureCRT帮助):
Application Object Properties and Methods
Properties
Methods
ActivePrinter
GetTabCount
Dialog
GetTab
Screen
Sleep
Session
Quit
Version
Window
Properties
ActivePrinter
Description
Returns or sets the name of the active printer.
Syntax
crt.ActivePrinter [ = printerName ]
Remarks
Read/Write string property.
Example:
If crt.ActivePrinter "\\SERVER\InkJet2" Then
crt.ActivePrinter = "\\SERVER\InkJet2"
MsgBox "Updated Printer"
End If
Dialog
Description
Returns a reference to SecureCRT's Dialog object.
Syntax
Set object = crt.Dialog
Remarks
See the Dialog object documentation for a description of its properties and methods.
Screen
Description
Returns a reference to SecureCRT's Screen object.
Syntax
Set object = crt.Screen
Remarks
Object variables assigned from the screen property require the "Set" syntax. See the Screen object documentation for a description of its properties and methods.
Session
Description
Returns a reference to SecureCRT's Session object.
Syntax
Set object = crt.Session
Remarks
See the Session object documentation for a description of its properties and methods.
Version
Description
Returns a string containing SecureCRT's version.
Syntax
crt.Version
Remarks
Read-only string property
Example:
MsgBox "The version of SecureCRT is: " & crt.Version
Window
Description
Returns a reference to SecureCRT's Window object.
Syntax
Set object = crt.Window
Remarks
See the Window object documentation for a description of its properties and methods.
Methods
GetTabCount
Description
Returns the number of tabs.
Syntax
object = crt.GetTabCount
Remarks
None.
GetTab
Description
Returns the tab object of the specified index.
Syntax
Set object = crt.GetTab arg
Remarks
This does not bring the tab to the foreground.
Sleep
Description
Specifies the time (in milliseconds) to pause the script's execution
Syntax
crt.Sleep millisec
Remarks
The amount of time that it takes to execute the Sleep() method itself is a factor in how long the script pauses. Therefore, the accuracy of invoking Sleep with small values of 1 or 10 milliseconds will be affected by this overhead.
Example:
' Send a CR and pause for one second
crt.Screen.Send vbCr
crt.Sleep 1000
Quit
Description
Causes SecureCRT to exit.
Syntax
crt.Quit
Remarks
A script that invokes Quit will be terminated immediately and cause SecureCRT to exit.
Properties
Methods
ActivePrinter
GetTabCount
Dialog
GetTab
Screen
Sleep
Session
Quit
Version
Window
Properties
ActivePrinter
Description
Returns or sets the name of the active printer.
Syntax
crt.ActivePrinter [ = printerName ]
Remarks
Read/Write string property.
Example:
If crt.ActivePrinter "\\SERVER\InkJet2" Then
crt.ActivePrinter = "\\SERVER\InkJet2"
MsgBox "Updated Printer"
End If
Dialog
Description
Returns a reference to SecureCRT's Dialog object.
Syntax
Set object = crt.Dialog
Remarks
See the Dialog object documentation for a description of its properties and methods.
Screen
Description
Returns a reference to SecureCRT's Screen object.
Syntax
Set object = crt.Screen
Remarks
Object variables assigned from the screen property require the "Set" syntax. See the Screen object documentation for a description of its properties and methods.
Session
Description
Returns a reference to SecureCRT's Session object.
Syntax
Set object = crt.Session
Remarks
See the Session object documentation for a description of its properties and methods.
Version
Description
Returns a string containing SecureCRT's version.
Syntax
crt.Version
Remarks
Read-only string property
Example:
MsgBox "The version of SecureCRT is: " & crt.Version
Window
Description
Returns a reference to SecureCRT's Window object.
Syntax
Set object = crt.Window
Remarks
See the Window object documentation for a description of its properties and methods.
Methods
GetTabCount
Description
Returns the number of tabs.
Syntax
object = crt.GetTabCount
Remarks
None.
GetTab
Description
Returns the tab object of the specified index.
Syntax
Set object = crt.GetTab arg
Remarks
This does not bring the tab to the foreground.
Sleep
Description
Specifies the time (in milliseconds) to pause the script's execution
Syntax
crt.Sleep millisec
Remarks
The amount of time that it takes to execute the Sleep() method itself is a factor in how long the script pauses. Therefore, the accuracy of invoking Sleep with small values of 1 or 10 milliseconds will be affected by this overhead.
Example:
' Send a CR and pause for one second
crt.Screen.Send vbCr
crt.Sleep 1000
Quit
Description
Causes SecureCRT to exit.
Syntax
crt.Quit
Remarks
A script that invokes Quit will be terminated immediately and cause SecureCRT to exit.