我使用 vbscript 创建了 bat 文件。并运行该脚本但批处理文件未运行请帮助我
Const ForReading=1, ForWriting=2, ForAppending=8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oServiceManager = CreateObject("com.sun.star.ServiceManager")
Set oDesktop = oServiceManager.createInstance("com.sun.star.frame.Desktop")
Dim aNoArgs()
Dim oDoc, myrows,inut, s, shell
s = 1
Set outFile = objFSO.CreateTextFile("C:\Program Files\WinSCP\" & "\Build.bat", True)
outFile.Close
Set outFile = objFSO.OpenTextFile("C:\Program Files\WinSCP\" & "\Build.bat", ForWriting, True)
outFile.WriteLine chr(34) & "C:\Program Files\WinSCP\winscp.exe" & chr(34) & " /console /script=page.txt"
outFile.Close
Set outFile = objFSO.CreateTextFile("C:\Program Files\WinSCP\" & "\Page.txt", True)
outFile.Close
Path = InputBox ("Enter Your Path:")
inut = "file:///" & Path
Set oDoc = oDesktop.loadComponentFromURL(inut, "_blank", 0, aNoArgs)
oDoc.CurrentController.Frame.ContainerWindow.setVisible(false)
set oSheet = oDoc.Sheets.getByName("Sheet1")
set oCell = oSheet.getCellByPosition( 3, 2 ) 'A2
DomainName = oCell.getString()
set oCell = oSheet.getCellByPosition( 3, 3 ) 'A2
nFile = oCell.getString()
nFile = nFile - 1
Set outFile = objFSO.OpenTextFile("C:\Program Files\WinSCP\" & "\Page.txt", ForWriting, True)
outFile.WriteLine "option confirm off"
outFile.WriteLine "open sftp://root@" & DomainName & " -hostkey=" & chr(34) &"ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"& Chr(34)
outFile.WriteLine "option transfer binary"
For i = 0 To nFile
set oCell = oSheet.getCellByPosition( 0, s ) 'A2
nValue = oCell.getString()
set oCell = oSheet.getCellByPosition( 1, s ) 'A2
nsValue = oCell.getString()
outFile.WriteLine "put " & nValue & " " & nsValue
s = s+1
Next
outFile.WriteLine "# Disconnect"
outFile.WriteLine "# close"
outFile.Close
oDoc.Close(true)
msgbox "Done"
set shell=createobject("wscript.shell")
shell.run "C:\Program Files\WinSCP\" & "\Build.bat"
set shell=nothing
我使用 vbscript 创建了 bat 文件。并运行该脚本但批处理文件未运行请帮助我
编辑:
Line: 49 Char: 1 Error: The system cannot find the specified Code: 80070002 Source: (nul)