きったんの頭ん中☆
WSH
サンプル
hello.vbs (VBScript)
Option Explicit '宣言の強制
WScript.Echo "Hello World!"
WScript.echo("Hello World!");
実行
wscript hello.vbs
cscript //Nologo hello.js
wsf
<package>
<job id="job1">
<script language="VBScript" src="j1.vbs"></script>
</job>
<job id="job2">
<script language="JScript" src="j2.js"></script>
</job>
</package>
WScript
プロパティ
- Arguments
- FullName
- Interactive
- Name
- Path
- ScriptFullName
- ScriptName
- StdErr
- StdIn
- StdOut
- Version
メソッド
- CreateObject
- ConnectObject
- DisconnectObject
- Echo
- GetObject
- Quit
- Sleep
Shell
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo WshShell.CurrentDirectory
プロパティ
- CurrentDirectory
- Environment
- SpecialFolders
メソッド
- AppActivate
- CreateShortcut
- Exec
- ExpandEnvironmentStrings
- LogEvent
- Popup
- RegDelete
- RegRead
- RegWrite
- Run
- SendKeys
Network
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo WshNetwork.CurrentDirectory
プロパティ
- ComputerName
- UserDomain
- UserName
メソッド
- AddWindowsPrinterConnection
- AddPrinterConnection
- EnumNetworkDrives
- EnumPrinterConnection
- MapNetworkDrive
- RemoveNetworkDrive
- RemovePrinterConnection
- SetDefaultPrinter
FileSystemObject
Set objFS = CreateObject("Scripting.FileSystemObject")
WScript.Echo objFS.Drives
プロパティ
メソッド
- CopyFile
- CopyFolder
- CreateFolder
- CreateTextFile
- DeleteFile
- DeleteFolder
- DriveExists
- FileExists
- FolderExists
- GetAbsolutePathName
- GetBaseName
- GetDrive
- GetDriveName
- GetExtensionName
- GetFile
- GetFileName
- GetFolder
- GetParentFolderName
- GetSpecialFolder
- GetTempName
- MoveFile
- MoveFolder
- OpenTextFile
Drives
プロパティ
Drive
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objDrive = objFS.GetDrive("c")
WScript.Echo objDrive.AvailableSpace
プロパティ
- AvailableSpace
- DriveLetter
- DriveType
- FileSystem
- FreeSpace
- IsReady
- Path
- RootFolder
- SerialNumber
- ShareName
- TotalSize
- VolumeName
Folders
プロパティ
メソッド
Folder
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder("c:\Windows")
WScript.Echo objFolder.Attributes
プロパティ
- Attributes
- DateCreated
- DateLastAccessed
- DateLastModified
- Drive
- Files
- IsRootFolder
- Name
- ParentFolder
- Path
- ShortName
- ShortPath
- Size
- SubFolders
- Type
メソッド
- Copy
- CreateTextFile
- Delete
- Move
Files
プロパティ
File
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFile = objFS.GetFolder("c:\text.txt")
WScript.Echo objFile.DateCreated
プロパティ
- Attributes
- DateCreated
- DateLastAccessed
- DateLastModified
- Drive
- Name
- ParentFolder
- Path
- ShortName
- ShortPath
- Size
- Type
メソッド
- Copy
- Delete
- Move
- OpenAsTextStream
XML (wsf)
- <?job?>
- <?XML?>
- <description>
- <example>
- <job>
- <named>
- <object>
- <package>
- <reference>
- <resource>
- <runtime>
- <script>
VBScript
演算記号
- - + * / \ ^ Mod &
- = <> < > <= >= Is
- Not And Or Xor Eqv Imp
制御
- Call
- Class
- Const
- Dim
- Do...Loop
- Erase
- Execute
- ExecuteGlobal
- Exit
- For Each...Next
- For...Next
- Function
- If...Then...Else
- On Error
- Option Explicit
- Private
- Property Get
- Property Let
- Property Set
- Public
- Randomize
- ReDim
- Rem
- Select Case
- Set
- Stop
- Sub
- While...Wend
- With
オブジェクト
- Class
- Debug
- Err
- Match
- RegExp
コレクション
定数
色
- vbBlack &h00
- vbRed &hFF
- vbGreen &hFF00
- vbYellow &hFFFF
- vbBlue &hFF0000
- vbMagenta &hFF00FF
- vbCyan &hFFFF00
- vbWhite &hFFFFFF
比較
- vbBinaryCompare 0
- vbTextCompare 1
日時
- vbSunday 1
- vbMonday 2
- vbTuesday 3
- vbWednesday 4
- vbThursday 5
- vbFriday 6
- vbSaturday 7
- vbUseSystemDayOfWeek 0
- vbFirstJan1 1
- vbFirstFourDays 2
- vbFirstFullWeek 3
日時形式
- vbGeneralDate 0
- vbLongDate 1
- vbShortDate 2
- vbLongTime 3
- vbShortTime 4
MsgBox
- vbOKOnly 0
- vbOKCancel 1
- vbAbortRetryIgnore 2
- vbYesNoCancel 3
- vbYesNo 4
- vbRetryCancel 5
- vbCritical 16
- vbQuestion 32
- vbExclamation 48
- vbInformation 64
- vbDefaultButton1 0
- vbDefaultButton2 256
- vbDefaultButton3 512
- vbDefaultButton4 768
- vbApplicationModal 0
- vbSystemModal 4096
- vbOK 1
- vbCancel 2
- vbAbort 3
- vbRetry 4
- vbIgnore 5
- vbYes 6
- vbNo 7
String
- vbCr Chr(13)
- VbCrLf Chr(13) & Chr(10)
- vbFormFeed Chr(12)
- vbLf Chr(10)
- vbNewLine Chr(13) & Chr(10) or Chr(10)
- vbNullChar Chr(0)
- vbNullString 0
- vbTab Chr(9)
- vbVerticalTab Chr(11)
Tristate
- vbUseDefault -2
- vbTrue -1
- vbFalse 0
型
- vbEmpty 0
- vbNull 1
- vbInteger 2
- vbLong 3
- vbSingle 4
- vbDouble 5
- vbCurrency 6
- vbDate 7
- vbString 8
- vbObject 9
- vbError 10
- vbBoolean 11
- vbVariant 12
- vbDataObject 13
- vbDecimal 14
- vbByte 17
- vbArray 8192
その他
- vbObjectError -2147221504
関数
- Abs
- Array
- Asc
- Atn
- CBool
- CByte
- CCur
- CDate
- CDbl
- Chr
- CInt
- CLng
- Conversions
- Cos
- CreateObject
- CSng
- CStr
- Date
- DateAdd
- DateDiff
- DatePart
- DateSerial
- DateValue
- Day
- Escape
- Eval
- Exp
- Filter
- FormatCurrency
- FormatDateTime
- FormatNumber
- FormatPercent
- GetLocale
- GetObject
- GetRef
- Hex
- Hour
- InputBox
- InStr
- InStrRev
- Int, Fix
- IsArray
- IsDate
- IsEmpty
- IsNull
- IsNumeric
- IsObject
- Join
- LBound
- LCase
- Left
- Len
- LoadPicture
- Log
- LTrim
- Maths
- Mid
- Minute
- Month
- MonthName
- MsgBox
- Now
- Oct
- Replace
- RGB
- Right
- Rnd
- Round
- RTrim
- ScriptEngine
- ScriptEngineBuildVersion
- ScriptEngineMajorVersion
- ScriptEngineMinorVersion
- Second
- SetLocale
- Sgn
- Sin
- Space
- Split
- Sqr
- StrComp
- String
- StrReverse
- Tan
- Time
- Timer
- TimeSerial
- TimeValue
- Trim
- TypeName
- UBound
- UCase
- Unescape
- VarType
- Weekday
- WeekdayName
- Year
リンク