'-------------------------------------------------------
' デスクトップに4桁の日付時刻を「ファイル名」にした
' フォルダの新規作成
'-------------------------------------------------------
'-------<デスクトップのパスを MyDesktop に取得>-------
Dim MyDesktop, WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
MyDesktop = WshShell.SpecialFolders("Desktop")
Dim FS
Set FS = CreateObject("Scripting.FileSystemObject")
Dim FileName, newFile, newText
Dim Nen, Tuki, Hi ,E
Nen = Mid(Date,4,1)
Tuki = Mid(Date,6,2)
Hi = Right(Date,2)
'-------<四桁の日付>-------------------
Select Case Tuki ' 変数 Tuki の月を一桁にする
Case "01": E = "1" ' 01 → 1 に変え、変数 E に入れる
Case "02": E = "2"
Case "03": E = "3"
Case "04": E = "4"
Case "05": E = "5"
Case "06": E = "6"
Case "07": E = "7"
Case "08": E = "8"
Case "09": E = "9"
Case "10": E = "x" ' 10月は、アルファベットの最後の3文字目の「X」
Case "11": E = "y" ' 昔の、電池や缶詰の4桁の日付の付け方
Case "12": E = "z" ' 16進数の A B C の方が良かったかもしれないが
End Select
Dim Hiduke
Hiduke = Nen + E + Hi
Dim Ji, J, Hun, H, Sec, S
Ji = Hour(time)
Hun = Minute(time)
Sec = Second(Time)
'-------<1桁の時分を2桁に>-------------------
Select Case Ji ' 変数 Ji の時刻の 1-9 を2桁にする
Case "1": J = "01" ' 1 → 01 に変え、変数 J に入れる
Case "2": J = "02"
Case "3": J = "03"
Case "4": J = "04"
Case "5": J = "05"
Case "6": J = "06"
Case "7": J = "07"
Case "8": J = "08"
Case "9": J = "09"
Case "0": J = "00"
Case Else
J = Ji
End Select
Select Case Hun ' 変数 Hun の分 1-9 を2桁にする
Case "1": H = "01" ' 1 → 01 に変え、変数 H に入れる
Case "2": H = "02"
Case "3": H = "03"
Case "4": H = "04"
Case "5": H = "05"
Case "6": H = "06"
Case "7": H = "07"
Case "8": H = "08"
Case "9": H = "09"
Case "0": H = "00"
Case Else
H = Hun
End Select
Select Case Sec ' 変数 Sec の秒 1-9 を2桁にする
Case "1": S = "01" ' 1 → 01 に変え、変数 S に入れる
Case "2": S = "02"
Case "3": S = "03"
Case "4": S = "04"
Case "5": S = "05"
Case "6": S = "06"
Case "7": S = "07"
Case "8": S = "08"
Case "9": S = "09"
Case "0": S = "00"
Case Else
S = Sec
End Select
'-------<フォルダを新規作成する>------
FileName = MyDesktop & "" & Hiduke & "_" & J & H
Set newFile = FS.CreateFolder(FileName)
' デスクトップに4桁の日付時刻を「ファイル名」にした
' フォルダの新規作成
'-------------------------------------------------------
'-------<デスクトップのパスを MyDesktop に取得>-------
Dim MyDesktop, WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
MyDesktop = WshShell.SpecialFolders("Desktop")
Dim FS
Set FS = CreateObject("Scripting.FileSystemObject")
Dim FileName, newFile, newText
Dim Nen, Tuki, Hi ,E
Nen = Mid(Date,4,1)
Tuki = Mid(Date,6,2)
Hi = Right(Date,2)
'-------<四桁の日付>-------------------
Select Case Tuki ' 変数 Tuki の月を一桁にする
Case "01": E = "1" ' 01 → 1 に変え、変数 E に入れる
Case "02": E = "2"
Case "03": E = "3"
Case "04": E = "4"
Case "05": E = "5"
Case "06": E = "6"
Case "07": E = "7"
Case "08": E = "8"
Case "09": E = "9"
Case "10": E = "x" ' 10月は、アルファベットの最後の3文字目の「X」
Case "11": E = "y" ' 昔の、電池や缶詰の4桁の日付の付け方
Case "12": E = "z" ' 16進数の A B C の方が良かったかもしれないが
End Select
Dim Hiduke
Hiduke = Nen + E + Hi
Dim Ji, J, Hun, H, Sec, S
Ji = Hour(time)
Hun = Minute(time)
Sec = Second(Time)
'-------<1桁の時分を2桁に>-------------------
Select Case Ji ' 変数 Ji の時刻の 1-9 を2桁にする
Case "1": J = "01" ' 1 → 01 に変え、変数 J に入れる
Case "2": J = "02"
Case "3": J = "03"
Case "4": J = "04"
Case "5": J = "05"
Case "6": J = "06"
Case "7": J = "07"
Case "8": J = "08"
Case "9": J = "09"
Case "0": J = "00"
Case Else
J = Ji
End Select
Select Case Hun ' 変数 Hun の分 1-9 を2桁にする
Case "1": H = "01" ' 1 → 01 に変え、変数 H に入れる
Case "2": H = "02"
Case "3": H = "03"
Case "4": H = "04"
Case "5": H = "05"
Case "6": H = "06"
Case "7": H = "07"
Case "8": H = "08"
Case "9": H = "09"
Case "0": H = "00"
Case Else
H = Hun
End Select
Select Case Sec ' 変数 Sec の秒 1-9 を2桁にする
Case "1": S = "01" ' 1 → 01 に変え、変数 S に入れる
Case "2": S = "02"
Case "3": S = "03"
Case "4": S = "04"
Case "5": S = "05"
Case "6": S = "06"
Case "7": S = "07"
Case "8": S = "08"
Case "9": S = "09"
Case "0": S = "00"
Case Else
S = Sec
End Select
'-------<フォルダを新規作成する>------
FileName = MyDesktop & "" & Hiduke & "_" & J & H
Set newFile = FS.CreateFolder(FileName)