我喜歡把自己的錯誤「10號線和2字符無效過程調用或參數」我運行下面VBSobjFile.Write(現在)無效的過程調用或參數
10號線和2夏亞
Const ForAppending = 8
Set objFSO = CreateObject("scripting.filesystemobject")
GetLogPath = "C:\Users\MyName\Desktop\New Text Document.log"
If objFSO.FileExists(GetLogPath) Then
set objFile = objFSO.OpenTextFile(GetLogPath)
else
set objFile = objFSO.CreateTextFile(GetLogPath)
End If
set objFile = objFSO.OpenTextFile(GetLogPath , ForAppending)
objFile.Write(FormatDateTime(Now))
objFile.WriteLine(" : ")
objFile.Close
我的系統日期和時間設置如下。
Bulgaria Date and Time settings
但是當我跑在其他PC和工作包含英語日期和時間設置精細相同的腳本。
< 輸出> 2017年9月13日下午5時44分十五秒:
能否請您在此情況下幫助。
爲什麼你甚至需要'FormatDateTime'?你有沒有嘗試在文件中編寫'Now'? –
是的,我試過用「objFile.Write Now」和「objFile.Write(Now)」。和我觀察所有的日期和時間功能,如日期,日......同樣的問題...... [鏈接](https://www.w3schools.com/asp/asp_ref_vbscript_functions.asp) –
我已經讀過VBScript可能運行的地方進入非英語語言環境的問題...嘗試通過連接datepart函數手動格式化日期和時間函數,如日,月和年 –