推定無題

日々調べたこととか

VBScript

VBScript: ごみ箱を空にする

ごみ箱を空にする。(XP) http://scripting.cocolog-nifty.com/blog/2007/12/post_df8d.html引用。XPで確認済み。 Set fso=CreateObject("Scripting.FileSystemObject") Set Shell=CreateObject("Shell.Application") Set Folder=Shell.NameSpace(10) For Eac…

VBScript: Windowsのシャットダウン、リブート

幾通りか方法がある。 WMIを使う、成否を取得可能 Shutdownコマンドを使う Xpepmコマンドを使う(XPeのみ) WMIを使う方法 元ネタは「WMIを使用してスクリプトの幅を広げる(044~050)」から。 Dim ws, w Set ws = GetObject("winmgmts:{(Shutdown)}//./root/ci…

VBScript: WMIを使ったサービスの状態取得、開始、停止

WMIを使ってサービスのオブジェクトを取得する。 クエリはサービス名と一致するものを指定。表示にする時は、DisplayName= にする。 Dim Services Set Services = GetObject("winmgmts:").ExecQuery("Select * from Win32_Service Where Name='サービス名'")…

VBScript: Visual Studio を使って VBScript をデバッグ実行する

外部ツールに登録して、実行する事で、一行ずつステップ実行が出来る様になる。 Visual Studio は VBScript 用の最強エディタ? [ツール]>[外部ツール]で登録する タイトル:VBScriptデバッグ実行(&D) コマンド:C:\Windows\System32\CScript.exe 引数://X…

VBScript: コンピュータ名、ユーザー名の取得

Dim ws, strComputerName, strUserName Set ws = WScript.CreateObject("WScript.Shell") strComputerName = ws.ExpandEnvironmentStrings("%COMPUTERNAME%") strUserName = ws.ExpandEnvironmentStrings("%USERNAME%") WScript.Echo strComputerName WScrip…

VBScript: 基本文法

下記を読めばばっちり。 VBScript 基礎文法最速マスター http://vbscript.g.hatena.ne.jp/cx20/20100131/1264906231 忘却録 大/小文字を区別しない Sub、Functionプロシージャの違い Sub 戻値なし Function 戻値あり 引数がない場合は()が必要。 引数がある…