PATH 環境変数をセミコロンで区切って一行づつ表示するバッチファイル( path-list.bat )

echo で VBScript の実行文を表示して、%temp%\_.vbs に書き出してそのまま実行するという、バッチファイルです。システム用とユーザ用を別々に作成して実行しています。

PATH コマンドの代りに使えます。

1.@echo off
2.echo ▼ システム
3.cmd /c echo Set ws=WScript.CreateObject("WScript.Shell"):Set wv=ws.Environment("SYSTEM"):pt=wv("PATH"):ad=Split(pt,";"):For I=0 To Ubound(ad):Wscript.echo ws.ExpandEnvironmentStrings(ad(I)):Next>%temp%\_.vbs&cscript.exe /NOLOGO %temp%\_.vbs
4.echo ▼ ユーザ
5.cmd /c echo Set ws=WScript.CreateObject("WScript.Shell"):Set wv=ws.Environment("USER"):pt=wv("PATH"):ad=Split(pt,";"):For I=0 To Ubound(ad):Wscript.echo ws.ExpandEnvironmentStrings(ad(I)):Next>%temp%\_.vbs&cscript.exe /NOLOGO %temp%\_.vbs
6.pause






VBScript で架空の氏名を作成するスクリプト / ( .WSF )

選択する漢字によっては、さらに架空度が増します。

結果をコマンドプロンプトへ出力する事を前提としているので、Wscript.exe でスクリプトが実行された場合、Crun という関数で コマンドプロンプトを開いて cscript.exe でスクリプトを強制的に再実行させるようにしています。

01.<JOB>
02.<OBJECT id="WshShell" progid="WScript.Shell" />
03.<SCRIPT language="VBScript">
04.' ***********************************************************
05.' 処理開始
06.' ***********************************************************
07.nMax = 20       ' 取得する人数
08. 
09.Crun
10. 
11.' 1、2 は教育漢字の最初
12.strName1 = "愛悪圧安暗案以位囲委意易異移胃衣遺医域育一印員因引飲院右宇羽"
13.strName2 = "雨運雲営映栄永泳英衛液益駅円園延沿演遠塩央往応横王黄億屋恩温"
14.strName3 = "男也一行樹之朗七人"
15.strName4 = "子代美恵"
16. 
17.For i = 1 to nMax
18. 
19.        ' 姓1文字目
20.        nTarget = Random( 1, Len(strName1) )
21.        strName = Mid( strName1, nTarget, 1 )
22. 
23.        ' 1文字目と2文字目が一致したら除外
24.        nTarget2 = nTarget
25.        Do while( nTarget = nTarget2 )
26.                nTarget2 = Random( 1, Len(strName1) )
27.        Loop
28. 
29.        ' 姓2文字目
30.        strName = strName & Mid( strName1, nTarget2, 1 ) & " "
31. 
32.        ' 名1文字目
33.        nTarget = Random( 1, Len(strName2) )
34.        strName = strName & Mid( strName2, nTarget, 1 )
35. 
36.        ' 性別
37.        nTarget = Random( 0, 1 )
38. 
39.        ' 性別によって名2文字目を決定
40.        if nTarget = 0 then
41.                nTarget = Random( 1, Len(strName3) )
42.                strName = strName & Mid( strName3, nTarget, 1 )
43.        else
44.                nTarget = Random( 1, Len(strName4) )
45.                strName = strName & Mid( strName4, nTarget, 1 )
46.        end if
47.         
48.        Wscript.Echo strName
49. 
50.Next
51. 
52.' ***********************************************************
53.' 範囲内ランダム値取得
54.' ***********************************************************
55.Function Random( nMin, nMax )
56. 
57.        Randomize
58.        Random = nMin + Int(Rnd * (nMax - nMin + 1))
59. 
60.End function
61. 
62.' ***********************************************************
63.' Cscript.exe で強制実行
64.' ***********************************************************
65.Function Crun( )
66. 
67.        Dim str
68. 
69.        str = WScript.FullName
70.        str = Right( str, 11 )
71.        str = Ucase( str )
72.        if str <> "CSCRIPT.EXE" then
73.                str = WScript.ScriptFullName
74.                strParam = " "
75.                For I = 0 to Wscript.Arguments.Count - 1
76.                        if instr(Wscript.Arguments(I), " ") < 1 then
77.                                strParam = strParam & Wscript.Arguments(I) & " "
78.                        else
79.                                strParam = strParam & Dd(Wscript.Arguments(I)) & " "
80.                        end if
81.                Next
82.                Call WshShell.Run( "cmd.exe /c cscript.exe " & Dd(str) & strParam & " & pause", 3 )
83.                WScript.Quit
84.        end if
85. 
86.End Function
87. 
88.' ***********************************************************
89.' ダブルクォート
90.' ***********************************************************
91.Function Dd( strValue )
92. 
93.        Dd = """" & strValue & """"
94. 
95.End function
96. 
97.</SCRIPT>
98.</JOB>

💙 例えば...
院引 演恵
域院 雲恵
衣位 応行
印意 央樹
羽因 往恵
院意 応行
位胃 沿子
囲移 塩子
異因 映代
以引 雨人
圧因 塩代
域右 温七
易育 延七
右委 黄子
異引 雲美
圧衣 園朗
愛員 王七
悪右 英之
圧遺 益樹
院暗 横美

VBScript を使用してプリンタ名の一覧を取得する


※ 一覧なので、cscript.exe PrinterList.vbs としたほうがいいでしょう。( スクリプトでは、Wscript.exe で実行した場合 コマンドプロンプトを開いて Cscript.exe で実行しなおすようになっています )



item.Name は FolderItem オブジェクトのプロパティです
FolderItem Properties (Windows)

01.Crun
02. 
03.Set objShell = CreateObject("Shell.Application")
04.Set objFolder = objShell.NameSpace(&H4)
05.Set colItems = objFolder.Items
06. 
07.For each item in colItems
08. 
09.        if item.Name <> "プリンタの追加" then
10.                Wscript.Echo item.Name
11.        end if
12. 
13.Next
14. 
15.' **********************************************************
16.' Cscript.exe で実行を強制
17.' Cscript.exe の実行終了後 pause で一時停止
18.' **********************************************************
19.Function Crun( )
20. 
21.        Dim str,WshShell
22. 
23.        str = WScript.FullName
24.        str = Right( str, 11 )
25.        str = Ucase( str )
26.        if str <> "CSCRIPT.EXE" then
27.                str = WScript.ScriptFullName
28. 
29.                Set WshShell = CreateObject( "WScript.Shell" )
30. 
31.                strParam = " "
32.                For I = 0 to Wscript.Arguments.Count - 1
33.                        if instr(Wscript.Arguments(I), " ") < 1 then
34.                                strParam = strParam & Wscript.Arguments(I) & " "
35.                        else
36.                                strParam = strParam & Dd(Wscript.Arguments(I)) & " "
37.                        end if
38.                Next
39.                Call WshShell.Run( "cmd.exe /c cscript.exe " & Dd(str) & strParam & " & pause", 1 )
40.                WScript.Quit
41.        end if
42. 
43.End Function
44.' **********************************************************
45.' 文字列を " で囲む関数
46.' **********************************************************
47.Function Dd( strValue )
48. 
49.        Dd = """" & strValue & """"
50. 
51.End function




エクスプローラ ( explorer.exe ) の再起動 / VBScript



レジストリで設定した内容を Windows に即時に反映させる必要がある時に使用します。

例えばショートカットのファイルは拡張子 .lnk が付いているのですが、一般的に表示される事はありません。これを表示させるには簡単で、手動でレジストリの コンピューター\HKEY_CLASSES_ROOT\lnkfile の中のエントリである NeverShowExt をAllwaysShowExt に名称変更すると .lnk が表示されるようになります。但しすぐには反映されないのでエクスプローラを再起動して即座に反映させます。

01.' **********************************************************
02.' エクスプローラ(explorer.exe) の再起動
03.' **********************************************************
04.strTarget = "explorer.exe"
05. 
06.' 起動用
07.Set WshShell = CreateObject( "WScript.Shell" )
08.' WMI用
09.Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
10. 
11.' いったん終了させます
12.Set colProcessList = objWMIService.ExecQuery _
13.        ("Select * from Win32_Process Where Name = '"&strTarget&"'")
14.For Each objProcess in colProcessList
15.        on error resume next
16.        ' 通常はこれで終了されるはず
17.        objProcess.Terminate()
18.        if Err.Number <> 0 then
19.                ' もし終了できなかった場合の強制終了
20.                Call WshShell.Run("taskkill /F /PID " & objProcess.ProcessId, 0 )
21.        end if
22.        on error goto 0
23.Next
24. 
25.' 少し待ちます
26.Wscript.Sleep(500)
27.' エクスプローラを起動
28.WshShell.Run( strTarget )




VBScript で 32ビット ODBC ドライバの一覧を取得する( ODBC 接続のドライバ文字列を正しく取得したい )

Windows でデータベースに接続する際、ODBC データソースに登録せずに動的に利用する場合には、ドライバの正しい文字列が必要になリます。レジストリエディタで参照すればいいのですが、結構面倒なのでこのスクリプトを使えばすぐ取り出せます。

最初の『管理者として cscript 実行を強制する』は、cscript での実行を強制するついでに実装しています。(なんらかの制限環境でも動くようにとの考慮です。)

目的は、レジストリのキーの一覧ですが、キーの一覧は知る限り、WMI でしか取得できないので、GetObject("Winmgmts:root\default:StdRegProv") でレジストリ処理用のオブジェクトを取得して使用します。

一覧表示は、cscript で実行を強制しているので単純に Wscript.Echo で出力。コマンドプロンプトを新たに作成して実行するので、結果の表示を止めるために、Wscript.StdIn.ReadLine です。
01.' 管理者として cscript 実行を強制する
02.Set obj = Wscript.CreateObject("Shell.Application")
03.if Wscript.Arguments.Count = 0 then
04.        obj.ShellExecute "cscript.exe", WScript.ScriptFullName & " runas", "", "runas", 1
05.        Wscript.Quit
06.end if
07. 
08.const WMI_HKEY_LOCAL_MACHINE = &H80000002
09. 
10.Set objRegistry = GetObject("Winmgmts:root\default:StdRegProv")
11. 
12.strBasePath = "SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI"
13. 
14.Call objRegistry.EnumKey( WMI_HKEY_LOCAL_MACHINE, strBasePath, aKeys )
15. 
16.For Each strKeyPath in aKeys
17.        Wscript.Echo strKeyPath
18.Next
19. 
20.Wscript.StdIn.ReadLine

実際はいくつか変なのが混じっていますが ODBC 接続のドライバ文字列が欲しい場合を想定しているので、その場合はそれは排除して見れると思います。



※ コマンドプロンプトのプロパティで、簡易編集モードを ON にして、範囲をドラッグして右クリックでコピーできます。

※ コマンドプロンプトならば、『reg query HKLM\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI』ですから、リダイレクトしてファイルに表示結果を書き込めばいいでしょう( 但し、キーが全て表示されるのでとても見にくいです )
reg query HKLM\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI > list.txt

PHP で MySQL のクエリテストする為のコード( Bootstrap 仕様 )

$_GET['text'] で入力された SQL が引き渡されます。
※ GET コマンドなので、IE11 以外ならば SQLは アドレスバーで直接入力ができると思います。
※ php-mysql-test.php?text=SQL文

テーブルの表現には Bootstrap を使用しています( 一応スマホではテーブル部分のみ横スクロールします )

QueryString に text が無い場合と text に有効な文字が全く無い場合は  show variables でシステム変数の一覧を表示します
001.<?php
002.// キャッシュを使用しない
003.session_cache_limiter('nocache');
004.session_start();
005. 
006.// UTF-8
007.header( "Content-Type: text/html; charset=utf-8" );
008. 
009.?>
010.<!DOCTYPE html>
011.<html>
012.<head>
013.<meta charset="utf-8">
014.<meta content="width=device-width initial-scale=1.0 minimum-scale=1.0 maximum-scale=1.0 user-scalable=no" name="viewport">
015.<title>SQL実行結果</title>
016.<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.css" />
017.<style>
018./*
019.罫線等のテーブルのレイアウトは、Bootstrap にて適用
020.table {
021.        border: solid 1px #000;
022.        border-collapse: collapse;
023.}
024. 
025.th,td {
026.        border: solid 1px #000;
027.        padding: 5px;
028.}
029.*/
030.</style>
031.</head>
032.<body>
033.<!-- Bootstrap の alert でタイトル -->
034.<div class="alert alert-dark">
035.        MySQL Query TEST
036.</div>
037. 
038.<?php
039.if ( !isset( $_GET['text'] ) || trim($_GET['text']) == "" ) {
040.        // クエリ初期値は システム変数一覧
041.        $_GET['text'] = "show variables";
042.}
043. 
044.// P で挟んだデータの出力
045.print_cell_html( "p", $_GET['text'] );
046. 
047.$server = 'localhost';
048.$dbname = 'lightbox';
049.$user = 'root';
050.$password = 'パスワード';
051. 
052.// ***************************
053.// 接続
054.// ***************************
055.$mysqli = @ new mysqli($server, $user, $password, $dbname);
056.if ($mysqli->connect_error) {
057.        print "接続エラーです : ({$mysqli->connect_errno}) ({$mysqli->connect_error})";
058.        exit();
059.}
060. 
061.// ***************************
062.// クライアントの文字セット
063.// ***************************
064.$mysqli->set_charset("utf8");
065. 
066.// ***************************
067.// クエリ
068.// ***************************
069.$result = $mysqli->query($_GET['text']);
070.if ( !$result ) {
071.        print "\n";
072.        print "<span style='color:#f00'>error : " . $mysqli->error . "</span>";
073.        exit();
074.}
075. 
076.// ***************************
077.// 列数
078.// ***************************
079.$nfield = $result->field_count;
080.if ( $nfield ) {
081.        $ncount = 0;
082.        print "<div class='table-responsive-sm'>";
083.        print "<table class='table table-bordered table-hover'><thead class='thead-dark'>\n";
084. 
085.        // 行番号用タイトル
086.        print "\t<th></th>";
087. 
088.        // 列のタイトルを作成
089.        $field = $result->fetch_fields( );
090.        for( $i = 0; $i < $nfield; $i++ ) {
091. 
092.                // TH で挟んだデータの出力
093.                print_cell_html( "th", $field[$i]->name );
094. 
095.        }
096. 
097.        print "</thead>\n<tbody>\n";
098. 
099.        // ***************************
100.        // 行データ
101.        // ※ 結果の行を数値添字配列で取得
102.        // ***************************
103.        while ($row = $result->fetch_row()) {
104. 
105.                print "<tr>\n\t";
106.                // 行番号
107. 
108.                // TDで挟んだデータの出力
109.                print_cell_html( "td", ($ncount + 1) );
110. 
111.                for( $i = 0; $i < $nfield; $i++ ) {
112. 
113.                        // TDで挟んだデータの出力
114.                        print_cell_html( "td", $row[$i] );
115. 
116.                }
117.                print "\n</tr>\n";
118. 
119.                // 行番号
120.                $ncount++;
121.        }
122. 
123.        print "</tbody></table>";
124.        print "</div>";
125. 
126.}
127. 
128.// ***************************
129.// 接続解除
130.// ***************************
131.$mysqli->close();
132. 
133. 
134.// ***************************
135.// セルの HTML 出力関数
136.// ***************************
137.function print_cell_html( $html, $data ) {
138. 
139.print <<<CELL_HTML
140.<{$html}>{$data}</{$html}>
141.CELL_HTML;
142. 
143.}
144. 
145.?>
146. 
147.</body>
148.</html>



jQuery で TABLE の 行内の 一つのTD をクリック。その後、他の TD 内のテキストを取得する / nextAll と prevAll

nextAll は、起点となる要素から下方向に存在する同じ階層の要素を全て取得します。引数にセレクタが指定できるので、ここでは TD にクラスを設定して目的の要素を特定しています。

特定する要素の属性が無い場合は、$(this).nextAll().eq(0).text() のようにして eq(順序番号) を指定して特定できます。但し、prevAll では近い要素から順序番号が小さくなるので注意して下さい。

コード 名称 金額 購入日 担当者 発注先
0002 問題集 002 4000 2015/08/24 田中 発注先002
0003 問題集 003 3000 2015/08/23 山田 発注先003
0004 問題集 004 2000 2015/08/22 山田 発注先004
0001 問題集 001 1000 2015/08/21 田中 発注先001
001.<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
002.<script>
003.$(function() {
004. 
005.        // 名称のリンクに設定したクラスでイベント作成
006.        // ※ 各 td のクラスで取得
007.        $(".check").on("click", function(){
008.                $("#cd").val($(this).prevAll(".t0").text());
009.                $("#name").val($(this).text());
010.                $("#kin").val($(this).nextAll(".t1").text());
011.                $("#bdate").val($(this).nextAll(".t2").text());
012.                $("#tanto").val($(this).nextAll(".t3").text());
013.                $("#co").val($(this).nextAll(".t4").text());
014.        });
015. 
016.        // 購入日のリンクに設定したクラスでイベント作成
017.        // ※ 各 td の順序で取得
018.        $(".t2").on("click", function(){
019.                $("#cd").val($(this).prevAll().eq(2).text());
020.                $("#name").val($(this).prevAll().eq(1).text());
021.                $("#kin").val($(this).prevAll().eq(0).text());
022.                $("#bdate").val($(this).text());
023.                $("#tanto").val($(this).nextAll().eq(0).text());
024.                $("#co").val($(this).nextAll().eq(1).text());
025.        });
026. 
027.});
028. 
029.</script>
030.<style type="text/css">
031..check, .t2 {
032.        text-decoration: underline;
033.        cursor: pointer;
034.        color: blue;
035.}
036.#target_area th, #target_area td {
037.        padding: 5px;
038.}
039.#target_area input {
040.        width:120px;
041.        font-size: 18px;
042.}
043.#target_area table {
044.        margin-top: 10px;
045.        border-collapse: collapse;
046.        border: solid #000000 1px;
047.        background-color: #ffffff;
048.}
049.#target_area th {
050.        border: solid #000000 1px;
051.        background-color: silver;
052.}
053.#target_area td {
054.        border: solid #000000 1px;
055.}
056.</style>
057.<div id="target_area">
058.<p><input id="cd"> <input id="name"> <input id="kin"></p>
059.<p><input id="bdate"> <input id="tanto"> <input id="co"></p>
060.<table>
061.        <tbody>
062.        <tr>
063.                <th>コード</th>
064.                <th>名称</th>
065.                <th>金額</th>
066.                <th>購入日</th>
067.                <th>担当者</th>
068.                <th>発注先</th>
069.        </tr>
070.        <tr>
071.                <td class="t0">0002</td>
072.                <td class="check">問題集 002</td>
073.                <td class="t1">4000</td>
074.                <td class="t2">2015/08/24</td>
075.                <td class="t3">田中</td>
076.                <td class="t4">発注先002</td>
077.        </tr>
078.        <tr>
079.                <td class="t0">0003</td>
080.                <td class="check">問題集 003</td>
081.                <td class="t1">3000</td>
082.                <td class="t2">2015/08/23</td>
083.                <td class="t3">山田</td>
084.                <td class="t4">発注先003</td>
085.        </tr>
086.        <tr>
087.                <td class="t0">0004</td>
088.                <td class="check">問題集 004</td>
089.                <td class="t1">2000</td>
090.                <td class="t2">2015/08/22</td>
091.                <td class="t3">山田</td>
092.                <td class="t4">発注先004</td>
093.        </tr>
094.        <tr>
095.                <td class="t0">0001</td>
096.                <td class="check">問題集 001</td>
097.                <td class="t1">1000</td>
098.                <td class="t2">2015/08/21</td>
099.                <td class="t3">田中</td>
100.                <td class="t4">発注先001</td>
101.        </tr>
102.        </tbody>
103.</table>
104.</div>





「送る」に入れる簡易ダンプ ( VBScript )





※コマンドプロンプトの操作
Q : 終了します。
スペースキー : 次ページを表示します。
Enterキー : 次の行を表示します


自分で環境を作って、VBScript のコードファイルも自分で配置する場合は以下をご覧下さい。

SendTo フォルダにショートカットを作成する



この時、作業フォルダーを用意してそこに VBScript のコードファイルを保存します。実行するコマンドラインは以下のようになっています。

%windir%\system32\wscript.exe dump.vbs 35

35 は、コマンドプロンプトに一度に表示する行数です

dump.vbs( 作業フォルダーに置いてください )
01.if WScript.Arguments.Count = 1 then
02.        strMessage = "送るから実行して下さい" & vbCrLf & vbCrLf
03.        strMessage = strMessage & "※ リンク先の最後の数字はコマンドプロンプトの行数です   " & vbCrLf
04.        strMessage = strMessage & "※ プロパティよりウインドウを最大化する方法もあります   " & vbCrLf
05.        Call MsgBox(strMessage,0,"lightbox")
06.        Wscript.Quit
07.end if
08. 
09.Set WshShell = CreateObject( "WScript.Shell" )  
10.Set Fso = CreateObject( "Scripting.FileSystemObject" )
11. 
12.strCurPath = WScript.ScriptFullName
13.Set obj = Fso.GetFile( strCurPath )
14.Set obj = obj.ParentFolder
15.strCurPath = obj.Path
16. 
17.strCommand = "cmd /c mode CON lines="&WScript.Arguments(0)&" & cscript.exe """ & _
18.strCurPath & "\dump_c.vbs"" """ & WScript.Arguments(1) & """ | more & pause"
19.Call WshShell.Run( strCommand )

dump_c.vbs
001.' ****************************************************
002.' ファイルを16進数でダンプします
003.' ****************************************************
004.Dim Fs,Stream
005.Dim InFile
006.Dim Kana
007.Dim KjFlg
008.Kana = Array( _
009."。","「","」","、","・","ヲ","ァ","ィ","ゥ","ェ","ォ","ャ","ュ","ョ","ッ", _
010."ー","ア","イ","ウ","エ","オ","カ","キ","ク","ケ","コ","サ","シ","ス","セ","ソ", _
011."タ","チ","ツ","テ","ト","ナ","ニ","ヌ","ネ","ノ","ハ","ヒ","フ","ヘ","ホ","マ", _
012."ミ","ム","メ","モ","ヤ","ユ","ヨ","ラ","リ","ル","レ","ロ","ワ","ン","゙","゚" )
013. 
014.Set Fs = CreateObject( "Scripting.FileSystemObject" )
015.Set Stream = CreateObject("ADODB.Stream")
016. 
017.InFile = WScript.Arguments(0)
018. 
019.Dim LineBuffer,DispBuffer,CWork,nCnt,strBuff,i,j
020. 
021.if not Fs.FileExists( InFile ) then
022.        Wscript.Echo "ファイルが存在しません"
023.        Wscript.Quit
024.end if
025. 
026.' ------------------------------------------------------
027.' Stream のオープン
028.Stream.Open
029.  
030.' ------------------------------------------------------
031.' Stream タイプの指定
032.Stream.Type = 1         ' StreamTypeEnum の adTypeBinary
033.  
034.' ------------------------------------------------------
035.' 既存ファイルの内容を Stream に読み込む
036.Stream.LoadFromFile InFile
037.  
038.' ------------------------------------------------------
039.' バイナリ型の Stream オブジェクトからを読み取って加工
040.Bcnt = 0
041.nCnt = 0
042.KjFlg = ""
043. 
044.Do while not Stream.EOS
045. 
046.        if ( nCnt MOD 16 ) = 0 then
047.                Wscript.Echo "          0  1  2  3  4  5  6  7" _
048.                & "  8  9  A  B  C  D  E  F"
049.                Wscript.Echo "--------------------------------" _
050.                & "------------------------------------------"
051.        end if
052. 
053.        ' 16 バイトの読込
054.        LineBuffer = Stream.Read(16)
055. 
056.        strBuff = ""
057.        For i = 1 to LenB( LineBuffer )
058.                CWork = MidB(LineBuffer,i,1)
059.                Cwork = AscB(Cwork)
060.                Cwork = Hex(Cwork)
061.                Cwork = Ucase(Cwork)
062.                Cwork = Right( "0" & Cwork, 2 )
063.                DispBuffer = DispBuffer & Cwork & " "
064.                strBuff = strBuff & CharConv( Cwork )
065.        Next
066. 
067.        Wscript.Echo _
068.                Right( _
069.                        "00000000" & Ucase(Hex( nCnt * 16 )), 8 _
070.                ) & " " & _
071.                Left(DispBuffer & String(49," "), 49 ) & strBuff
072.        DispBuffer = ""
073. 
074.        nCnt = nCnt + 1
075.  
076.Loop
077.  
078.' ------------------------------------------------------
079.' Stream を閉じる
080.Stream.Close
081. 
082.Set Stream = Nothing
083.Stream = Empty
084.Set Fs = Nothing
085.Fs = Empty
086. 
087.' ****************************************************
088.' 生データのテキスト
089.' ****************************************************
090.function CharConv( HexCode )
091. 
092.        Dim nCode
093. 
094.        nCode = Cint( "&H" & HexCode )
095. 
096.        if KjFlg = "" then
097.                if &H81 <= nCode and nCode <= &H84 or _
098.                        &H88 <= nCode and nCode <= &H9f or _
099.                        &HE0 <= nCode and nCode <= &HEA then
100.                        KjFlg = HexCode
101.                        CharConv = ""
102.                        Exit Function
103.                end if
104.        else
105.                if HexCode <> "00" then
106.                        KjFlg = KjFlg & HexCode
107.                        CharConv = Chr( Cint( "&H" & KjFlg ) )
108.                else
109.                        CharConv = ".."
110.                end if
111.                KjFlg = ""
112.                Exit Function
113.        end if
114. 
115.        if 0 <= nCode and nCode <= &H1F then
116.                CharConv = "."
117.        end if
118.        if &H20 <= nCode and nCode <= &H7E then
119.                CharConv = Chr(nCode)
120.        end if
121.        if &H7F <= nCode and nCode <= &HA0 then
122.                CharConv = "."
123.        end if
124.        if &HA1 <= nCode and nCode <= &HDF then
125.                CharConv = Kana(nCode-&HA1)
126.        end if
127.        if &HE0 <= nCode and nCode <= &HFF then
128.                CharConv = "."
129.        end if
130. 
131.end function

ショートカットを直接実行すると、以下のようなダイアログが出ます



最大化は、dump.vbs の 17行目からを、画面の解像度に合わせてカラム数を以下のように設定して実行時のウインドウを選択すると実装できます( ただ、ダンプの表示幅が決まっているのでこの場合あまり意味ありません )

strCommand = "cmd /c mode CON cols=160 & cscript.exe """ & _
strCurPath & "\dump_c.vbs"" """ & WScript.Arguments(1) & """ | more & pause"
Call WshShell.Run( strCommand, 3 )

操作補足

エクスプローラで SendTo フォルダに移動するには、アドレスバーに sendto と直接入力します。





GUID を取得してクリップボードにコピーする ( VBScript )

TypeLib.Guid で取得するのですが、取得した文字列の最後に NULL が現れるので Left 関数で文字列のみを取得しなおしています。

1) 最も多様なテクニックを使用して取得

クリップボードへのアクセスは clip.exe 
( コマンドプロンプトでリダイレクトが必要です )
01.' GUID 取得用
02.Set TypeLib = CreateObject("Scriptlet.TypeLib")
03. 
04.' 外部実行・環境変数取得用
05.Set WshShell = WScript.CreateObject("WScript.Shell")
06. 
07.' テキストファイル出力用
08.Set Fs = CreateObject( "Scripting.FileSystemObject" )
09. 
10.' テンポラリフォルダの取得
11.TempFolder = WshShell.ExpandEnvironmentStrings("%TEMP%")
12. 
13.' テキストファイルを出力用に開く
14.Set OutObj = Fs.OpenTextFile( TempFolder & "\_guid_text.txt", 2, True )
15. 
16.' GUID を出力
17.guid = Left( TypeLib.Guid & "", 38 )
18.OutObj.Write guid
19. 
20.' clip.exe を使用してクリップボードにコピー
21.' ※ 同期処理でコマンドプロンプトを表示しません
22.Call WshShell.Run( "cmd.exe /c clip.exe < """ & TempFolder & "\_guid_text.txt""",0, True )
23. 
24.' メッセージ
25.MsgBox( guid & " をクリップボードにコピーしました" )

2) clip.exe を使用したセオリー的な取得

クリップボードへのアクセスは clip.exe 
( コマンドプロンプトでリダイレクトが必要です )
01.' GUID 取得用
02.Set TypeLib = CreateObject("Scriptlet.TypeLib")
03. 
04.' 外部実行
05.Set WshShell = WScript.CreateObject("WScript.Shell")
06. 
07.' GUID を取得
08.guid = Left( TypeLib.Guid & "", 38 )
09. 
10.' clip.exe を使用してクリップボードにコピー
11.' ※ 同期処理でコマンドプロンプトを表示して一旦停止します
12.' 1) テキストの内容をクリップボードにコピー]
13.' 2) メッセージ
14.' 3) pause で停止
15.Call WshShell.Run( "cmd.exe /c echo " & guid & " | clip.exe & echo " & guid & " をクリップボードにコピーしました" & " & pause", , True )

3) InternetExplorer.Application でクリップボードへコピーする
01.' GUID 取得用
02.Set TypeLib = CreateObject("Scriptlet.TypeLib")
03. 
04.' クリップボード用
05.' ※ HTA 等では直接 window.clipboardData より実行
06.' ※ するように書き換える必要があります
07.Set objIE = CreateObject("InternetExplorer.Application")
08.objIE.Navigate("about:blank")
09.Do While objIE.Busy
10.        ' 100 ミリ秒
11.        Wscript.Sleep 100
12.Loop
13. 
14.Call objIE.document.parentWindow.clipboardData.SetData( "Text", TypeLib.Guid & "" )
15.objIE.Quit
16. 
17.WScript.Echo "クリップボードにコピーしました" & vbCrLf & vbCrLf & TypeLib.Guid

4) 自分でクリップボードへコピーする
1.' GUID 取得用
2.Set TypeLib = CreateObject("Scriptlet.TypeLib")
3. 
4.Call InputBox("コピーして使用して下さい","新しい GUID を取得しました",TypeLib.Guid)



Google Chrome デベロッパーツールで知っておきたいテクニック

ESC で コンソールタブ以外で下部にコンソールを表示する



ESC で表示・非表示が切り替えられます。

リロードボタン長押しでオプションメニュー



デベロッパーツールが開いている状態でのみ、メニューが表示されてリロード方法を選択できるようになります。特に、最後の『キャッシュの消去とハード再読み込み』は、ショートカットキーが無いのでこのメニューからのみ利用できます。

ドラッグ & ドロップで要素を移動



ドラッグで top_1 の div を移動中です。ドロップすると移動され、CTRL+Z で元に戻ります

CSS のカラーフォーマットをその場で変更表示

カラー部分を、SHIFT を押しながらクリックすると、フォーマットが切り替わって循環します。



複数の JavaScript ソースより文字列検索



JavaScript の整形



ソースのスペースの表示

F1 で settings を開きます



▼ スペース


▼ タブ


コンソールから関数のブレイクポイント作成

debug( 関数名 )

▼ 解除
undebug( 関数名 )

インスペクト直後のオブジェクト参照

$0

dir( $0 )

表示された内容を右クリックして表示されるメニューから、要素タブの該当部分へ戻れます
( $0 でも dir($0) でもどちらでも )



console.log では、以下のフォーマット文字列が使えます

console.log('%cBlue! %cRed!', 'color: blue;', 'color: red;'); のように複数も可

指定子 出力
%s 値を文字列としてフォーマットします。
%i または %d 値を整数としてフォーマットします。
%f 値を浮動小数点値としてフォーマットします。
%o 値を展開可能な DOM 要素としてフォーマットします。[Elements] パネルに表示されるフォーマットです。
%O 値を展開可能な JavaScript オブジェクトとしてフォーマットします。
%c 2 番目のパラメータで指定されたように出力文字列に CSS スタイルルールを適用します。

%c は、続く文字列に対してスタイルを適用するものなので、色や大きさ等いろいろな表現をコンソール上で行います

この方法を使うと背景に画像を設定できるので、コンソールに画像を表示する事もできます。
1.console.log("%c%s","background: url('https://lh3.googleusercontent.com/-lpfmi9vuwOg/WDVegEds_SI/AAAAAAAAhxc/0DzXoBQQlJw_L7KXSIi2UY0hEJwjiNcHwCHM/s128/internet_kanki_woman1.png'); font-size: 1240px;"," ")

コンソールで IFRAME を選択

デフォルトでは、トップフレームなので IFRAME の中で作業したい場合に選択します。インスペクトで IFRAME 部分を選択してからコンソールに移動すると、IFRAME 内でコンソールが動作しています。



その他

コンソールでは、SHIFT+Enter で複数行可

copy コマンド( コンソールのみ ) でクリップボードへコピー