Skip to content

Instantly share code, notes, and snippets.

@whaison
Created February 5, 2017 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whaison/af0d383d96ea9384c48c41add25af0e9 to your computer and use it in GitHub Desktop.
Save whaison/af0d383d96ea9384c48c41add25af0e9 to your computer and use it in GitHub Desktop.
ShowWSHInfo_sift_jis_00100_.vbs DebugLog
Option Explicit
'WScript.Echo "WSHの実行ファイル名:" & WScript.Name & vbCrLf & _
' "実行ファイルのあるフォルダ・パス:" & WScript.Path & vbCrLf & _
' "実行ファイルのフルパス:" & WScript.FullName & vbCrLf & _
' "バージョン:" & WScript.Version
'---------------------------
'Windows Script Host
'---------------------------
'WSHの実行ファイル名:Windows Script Host
'実行ファイルのあるフォルダ・パス:C:\Windows\System32
'実行ファイルのフルパス:C:\Windows\System32\WScript.exe
'バージョン:5.812
'---------------------------
'OK
'--------------------------
If False Then
' 実行したくない処理 VBScriptは複数行を一度にコメントアウトできない
xx
yy
End If
'-----------------------------Print("Hello Windows Script Host")
'WScript.Echo "Hello Windows Script Host"
'WScript.Echo "こんにちは ! ウィンドウズ スクリプト ホストさん"
'---------------------------------------------------------------
'-------------------------------------[ファイルに改行付きでデータを書き込む]------http://www.whitire.com/vbs/tips0067.html
On Error Resume Next
'--------------------------------------------------------------
Dim DebugLog___Data
Function DebugLog(strData)
Dim objFSO ' FileSystemObject
Dim objFile ' ファイル書き込み用
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
If Err.Number = 0 Then
Set objFile = objFSO.OpenTextFile("ShowWSHInfo_sift_jis_00100___Log.txt", 2, True)
If Err.Number = 0 Then
'objFile.WriteLine("Hello VBScript World 123")
DebugLog___Data=DebugLog___Data + strData + vbCrLf
objFile.WriteLine(DebugLog___Data)
objFile.Close
Else
WScript.Echo "ファイルオープンエラー: " & Err.Description
End If
Else
WScript.Echo "エラー: " & Err.Description
End If
End Function
DebugLog("debug_txt")
DebugLog("debug_txt2")
DebugLog("debug_txt3")
@whaison
Copy link
Author

whaison commented Feb 5, 2017

debug_txt
debug_txt2
debug_txt3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment