2011-01-01から1年間の記事一覧
Set d = CreateObject("Scripting.Dictionary") d.Add "a", "アテネ" d.Add "b", "ベオグラード" d.Add "c", "カイロ" a = d.Keys For Each x in a WScript.Echo "d(" & x & ") : " & d.Item(x) Next
かなり、まんま Set d = CreateObject("Scripting.Dictionary") d.Add "a", "アテネ" d.Add "b", "ベオグラード" d.Add "c", "カイロ" a = d.Items For i = 0 To d.Count -1 WScript.Echo "a(" & i & ") : " & a(i) Next
かなり、まんま Set d = CreateObject("Scripting.Dictionary") d.Add "a", "アテネ" d.Add "b", "ベオグラード" d.Add "c", "カイロ" Sub chk_exists(key) If d.Exists(key) Then WScript.Echo "Exists : " & key Else WScript.Echo "No Exists : " & key E…
http://msdn.microsoft.com/ja-jp/library/cc428203.aspx あたりにFileSystemObject オブジェクトの説明があったので見ていくまんま Dim d ' Create a variable. Set d = CreateObject("Scripting.Dictionary") d.Add "a", "アテネ" d.Add "b", "ベオグラー…
Set WshNetwork = WScript.CreateObject("WScript.Network") Set oPrinters = WshNetwork.EnumPrinterConnections WScript.Echo oPrinters.Count For Each x in oPrinters WScript.Echo x Next WshController, WshRemote, WshRemoteError オブジェクトは、と…
Set WshNetwork = WScript.CreateObject("WScript.Network") Set oDrives = WshNetwork.EnumNetworkDrives WScript.Echo oDrives.Count For Each x in oDrives WScript.Echo x Next ペアで情報が格納されるらしい
WshNetwork オブジェクトに関しては、設定系のメソッドはとばし Set WshNetwork = WScript.CreateObject("WScript.Network") WScript.Echo "ドメイン = " & WshNetwork.UserDomain WScript.Echo "コンピュータ名 = " & WshNetwork.ComputerName WScript.Echo…
WScript.Echo WScript.Arguments.Named.Exists("C") WScript.Echo WScript.Arguments.Named.Exists("D") 存在するときにブール値が返ってくるはずなのだが、なぜか「-1」が表示される。数値扱いで表示? WScript.Echo WScript.Arguments.Named.Exists("C") &…
まんま set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Microsoft Web Site.url") oUrlLink.TargetPath = "http://www.microsoft.com" oUr…
まんま <package> <job id="vbs"> <script language="VBScript"> set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop & "\ショートカット スクリプト.lnk") oShellLink.TargetPath = WScript.ScriptFu</job></package>…
既存のショートカットも参照できるらしい Sub DispShortcut(path) 'set shortcut = WshShell.CreateShortcut() set shortcut = WshShell.CreateShortcut(path) With shortcut WScript.Echo "Arguments: " & .Arguments WScript.Echo "Description: " & .Desc…
set WshShell = WScript.CreateObject("WScript.Shell") WScript.Echo WshShell.SpecialFolders("AllUsersDesktop") WScript.Echo WshShell.SpecialFolders.Item("AllUsersDesktop") WScript.Echo WshShell.SpecialFolders.Count 単にコレクションというだけ…
Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") WScript.Echo "before" Set oExec = WshShell.Exec("2011121900.bat") oExec.Terminate WScript.Echo "after" で、2011121900.bat は、 ping localhost -n 2 > NUL REM pause
まんま Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("%comspec% /c dire") Function ReadAllFromAny(oExec) If Not oExec.StdOut.AtEndOfStream Then ReadAllFromAny = oExec.StdOut.ReadAll Exit Functio…
まんま Dim WshShell, oExec, input Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("2011121700.bat") input = "" Do While True If Not oExec.StdOut.AtEndOfStream Then c = oExec.StdOut.Read(1) input = input & c If InStr(…
まんま Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("calc") Do While oExec.Status = 0 WScript.Sleep 100 Loop WScript.Echo oExec.Status
set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "Notepad" WScript.Sleep 100 WshShell.SendKeys "{{}" WshShell.SendKeys "{}}" WshShell.SendKeys "{[}" WshShell.SendKeys "{]}" WshShell.SendKeys "" WshShell.SendKeys "+a" WshSh…
Reg* メソッドは実行してレジストリが壊れたらいやなので、とばしまんま Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "%windir%\notepad " & WScript.ScriptFullName WScript.Echo "End" まんま Set WshShell = WScript.CreateObjec…
Set WshShell = WScript.CreateObject("WScript.Shell") WScript.Echo WshShell.Popup("Hello!") WScript.Echo WshShell.Popup("Message2", 1) WshShell.Popup "Message2", 1, "TITLE" WshShell.Popup "Message2", 1, "", 1 Set WshShell = WScript.CreateOb…
Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.LogEvent 0, "LogEvent のテスト"
まんま set WshShell = WScript.CreateObject("WScript.Shell") WScript.Echo "WinDir is " & WshShell.ExpandEnvironmentStrings("%WinDir%")
set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set URL = WshShell.CreateShortcut(strDesktop & "\Web URL.url") URL.TargetPath = "http://www.yahoo.co.jp/" URL.Save
まんま set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "calc" WScript.Sleep 100 WshShell.AppActivate "Calculator" WScript.Sleep 100 WshShell.SendKeys "1{+}" WScript.Sleep 500 WshShell.SendKeys "2" WScript.Sleep 500 WshShe…
set WshShell = WScript.CreateObject("WScript.Shell") WScript.Echo WshShell.SpecialFolders("AllUsersDesktop") WScript.Echo WshShell.SpecialFolders("AllUsersStartMenu") WScript.Echo WshShell.SpecialFolders("AllUsersPrograms") WScript.Echo Ws…
まんま Dim WshShell Set WshShell = WScript.CreateObject("WScript.Shell") WScript.Echo WshShell.CurrentDirectory
まんま set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk") oShellLink.TargetPath = WScript.ScriptFullName oShell…
まんま Dim WshShell, WshEnv Set WshShell = WScript.CreateObject("WScript.Shell") Set WshEnv = WshShell.Environment("PROCESS") WshEnv("TestVar") = "Windows Script Host" WScript.Echo WshShell.ExpandEnvironmentStrings("The value of the test v…
まんま Set WshShell = WScript.CreateObject("WScript.Shell") Set WshSysEnv = WshShell.Environment("SYSTEM") WScript.Echo WshSysEnv("NUMBER_OF_PROCESSORS") Set WshShell = WScript.CreateObject("WScript.Shell") Set WshSysEnv = WshShell.Environ…
「.wsf」という拡張子で <package> <job> <runtime> <description>あいうえお</description> <named name="a" helpstring="option a" type="string" required="true"/> <named name="b" helpstring="option b" type="string" required="false"/> <example> EXAMPLE ~~~ </example></named></named></runtime></job></package>
WScript.Echo WScript.Arguments.Count WScript.Echo WScript.Arguments.Named.Count WScript.Echo WScript.Arguments.Unnamed.Count For Each x in WScript.Arguments.Named WScript.Echo x & " = " & WScript.Arguments.Named(x) Next For Each x in WScri…