任務調度我有叫vbs腳本如下的批處理文件:在Win 2008將不會運行VBS腳本
cd d:
cd D:\Application\Pentasafe\HKPentasafe\DailyLog\Deployment Code
cscript CommandProcessing.vbs
del /s "D:\Application\Pentasafe\HKPentasafe\DailyLog\Command Usage by Command\Tempworkspace\*.txt"
此批處理文件調用這VBS(commandprocessing)thenit將刪除tempworkspace文件
Const ForReading = 1
Const ForWriting = 2
Dim Source, Dest
objStartFolder = "D:\Application\Pentasafe\HKPentasafe\DailyLog\Command Usage by Command\Tempworkspace"
objDestFolder = "D:\Application\Pentasafe\HKPentasafe\DailyLog\Command Usage by Command\Scripted"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
'Only one file expected.
For Each objFile in colFiles
Source = ObjStartFolder + "\" + objFile.Name
Dest = ObjDestFolder + "\" + objFile.Name
wscript.echo Source
wscript.echo Dest
Next
Set objFile = objFSO.OpenTextFile(Source, ForReading)
Set objFile1 = objFSO.CreateTextFile(Dest, ForWriting)
Do Until objFile.AtEndOfStream
Strline = objFile.ReadLine
'wscript.echo Strline
If InStr(Strline,"CHGUSRPRF") Then
Prependtext = "CHGUSRPRF"
wscript.echo Strline
objFile1.WriteLine Strline
ElseIf InStr(Strline,"STRSQL") Then
Prependtext = "STRSQL"
wscript.echo Strline
objFile1.WriteLine Strline
ElseIf InStr(Strline,"STRDFU") Then
Prependtext = "STRDFU"
wscript.echo Strline
objFile1.WriteLine Strline
ElseIf InStr(Strline,"UPDATA") Then
Prependtext = "UPDATA"
wscript.echo Strline
objFile1.WriteLine Strline
ElseIf InStr(Strline,"EZVIEW") Then
Prependtext = "EZVIEW"
wscript.echo Strline
objFile1.WriteLine Strline
ElseIf InStr(Strline,"WRKQRY") Then
Prependtext = "WRKQRY"
wscript.echo Strline
objFile1.WriteLine Strline
ElseIf InStr(Strline,"WRKUSRPRF") Then
Prependtext = "WRKUSRPRF"
wscript.echo Strline
objFile1.WriteLine Strline
ElseIf InStr(Strline, " ") Then
If (Prependtext <> "") Then
objFile1.WriteLine Replace(Strline, " ", Prependtext)
wscript.echo Replace(Strline, " ", Prependtext)
else
objFile1.WriteLine Strline
End If
Else
Prependtext = ""
objFile1.WriteLine Strline
End If
Loop
objFile.Close
objFile1.Close
但是,當我安排在窗口服務器2008年這個工作..它總是不會調用vbs腳本。而是跳過它然後做刪除工作。 我嘗試通過雙擊批處理文件手動運行它.. 它運行良好的窗口XP直到我們升級到窗口服務器2008.任何人有任何想法在這個話題?
感謝指出..該vbs文件是在.bat文件,爲什麼我沒有把路徑名稱相同的目錄。 – cheeseng 2012-07-11 07:51:16