dump.zip の中には、dump.vbs が入っているだけです。dump.vbs を Windows フォルダに保存するのが一番簡単ですが、パスの通ったフォルダならどこでもかまいません。 実行は、 dump ファイルパス とするか、 dump ファイルパス 出力先 の二通りです。 内部で再び cmd.exe を呼び出して、cscript.exe で実行していますので、新しいコマンドプロンプトが表示されて実行されます。1024 バイトまでのファイルですと、内容が表示されて pause 状態になります。1024 バイトより大きい場合は、more で実行されます。 出力先を指定すると、リダイレクトを使って出力されます。 ソースコード
Dim Fs,Stream
Set Fs = CreateObject( "Scripting.FileSystemObject" )
Crun()
' ****************************************************
' ファイルを16進数でダンプします
' ****************************************************
Dim InFile
Dim Kana
Dim KjFlg
Kana = Array( _
"。","「","」","、","・","ヲ","ァ","ィ","ゥ","ェ","ォ","ャ","ュ","ョ","ッ", _
"ー","ア","イ","ウ","エ","オ","カ","キ","ク","ケ","コ","サ","シ","ス","セ","ソ", _
"タ","チ","ツ","テ","ト","ナ","ニ","ヌ","ネ","ノ","ハ","ヒ","フ","ヘ","ホ","マ", _
"ミ","ム","メ","モ","ヤ","ユ","ヨ","ラ","リ","ル","レ","ロ","ワ","ン","゙","゚" )
Set Stream = CreateObject("ADODB.Stream")
InFile = WScript.Arguments(0)
Dim LineBuffer,DispBuffer,CWork,nCnt,strBuff,i,j
if not Fs.FileExists( InFile ) then
Wscript.Echo "ファイルが存在しません"
Wscript.Quit
end if
' ------------------------------------------------------
' Stream のオープン
Stream.Open
' ------------------------------------------------------
' Stream タイプの指定
Stream.Type = 1 ' StreamTypeEnum の adTypeBinary
' ------------------------------------------------------
' 既存ファイルの内容を Stream に読み込む
Stream.LoadFromFile InFile
' ------------------------------------------------------
' バイナリ型の Stream オブジェクトからを読み取って加工
Bcnt = 0
nCnt = 0
KjFlg = ""
Do while not Stream.EOS
if ( nCnt MOD 16 ) = 0 then
Wscript.Echo " 0 1 2 3 4 5 6 7" _
& " 8 9 A B C D E F"
Wscript.Echo "--------------------------------" _
& "------------------------------------------"
end if
' 16 バイトの読込
LineBuffer = Stream.Read(16)
strBuff = ""
For i = 1 to LenB( LineBuffer )
CWork = MidB(LineBuffer,i,1)
Cwork = AscB(Cwork)
Cwork = Hex(Cwork)
Cwork = Ucase(Cwork)
Cwork = Right( "0" & Cwork, 2 )
DispBuffer = DispBuffer & Cwork & " "
strBuff = strBuff & CharConv( Cwork )
Next
Wscript.Echo _
Right( _
"00000000" & Ucase(Hex( nCnt * 16 )), 8 _
) & " " & _
Left(DispBuffer & String(49," "), 49 ) & strBuff
DispBuffer = ""
nCnt = nCnt + 1
Loop
' ------------------------------------------------------
' Stream を閉じる
Stream.Close
Set Stream = Nothing
Stream = Empty
Set Fs = Nothing
Fs = Empty
' ****************************************************
' 生データのテキスト
' ****************************************************
function CharConv( HexCode )
Dim nCode
nCode = Cint( "&H" & HexCode )
if KjFlg = "" then
if &H81 <= nCode and nCode <= &H84 or _
&H88 <= nCode and nCode <= &H9f or _
&HE0 <= nCode and nCode <= &HEA then
KjFlg = HexCode
CharConv = ""
Exit Function
end if
else
if HexCode <> "00" then
KjFlg = KjFlg & HexCode
CharConv = Chr( Cint( "&H" & KjFlg ) )
else
CharConv = ".."
end if
KjFlg = ""
Exit Function
end if
if 0 <= nCode and nCode <= &H1F then
CharConv = "."
end if
if &H20 <= nCode and nCode <= &H7E then
CharConv = Chr(nCode)
end if
if &H7F <= nCode and nCode <= &HA0 then
CharConv = "."
end if
if &HA1 <= nCode and nCode <= &HDF then
CharConv = Kana(nCode-&HA1)
end if
if &HE0 <= nCode and nCode <= &HFF then
CharConv = "."
end if
end function
' **********************************************************
' Cscript.exe で実行を強制
' ウィンドウをアクティブにし、最大化ウィンドウとして表示(3)
' Cscript.exe の実行終了後 pause で一時停止
' **********************************************************
Function Crun( )
Dim str,WshShell
Set WshShell = CreateObject( "WScript.Shell" )
str = WScript.ScriptFullName
if Wscript.Arguments.Count = 0 then
Wscript.Echo "1) dump ファイルパス" & vbCrLf & "2) dump ファイルパス 出力ファイル"
WScript.Quit
end if
if Wscript.Arguments.Count = 1 then
if not Fs.FileExists( Wscript.Arguments(0) ) then
Wscript.Echo "ファイルが存在しません"
Wscript.Quit
end if
Set FileObj = Fs.GetFile( Wscript.Arguments(0) )
if FileObj.Size <= 1024 then
Call WshShell.Run( "cmd.exe /c cscript.exe " & Dd(str) & " " & Dd(Wscript.Arguments(0)) & " dummy dummy & pause", 3 )
else
Call WshShell.Run( "cmd.exe /c cscript.exe " & Dd(str) & " " & Dd(Wscript.Arguments(0)) & " dummy dummy | more", 3 )
end if
WScript.Quit
end if
if Wscript.Arguments.Count = 2 then
if not Fs.FileExists( Wscript.Arguments(0) ) then
Wscript.Echo "ファイルが存在しません"
Wscript.Quit
end if
Call WshShell.Run( "cmd.exe /c cscript.exe " & Dd(str) & " " & Dd(Wscript.Arguments(0)) & " dummy dummy > " & Dd(Wscript.Arguments(1)), 3 )
WScript.Quit
end if
End Function
' **********************************************************
' 文字列を " で囲む関数
' **********************************************************
Function Dd( strValue )
Dd = """" & strValue & """"
End function
以下は dump.zip をダンプ実行したコマンドプロンプトの状態です![]()
|
|
【フリーソフトの最新記事】
- サクラエディタの初期設定
- FileZilla のインストール時のポイント
- JGREP 2.0.5 は Windows10 でも重宝しています
- DF.exe ( テキストファイル差分表示 ) の初期基本設定
- TeraPad 導入時の設定
- FileZilla FTP クライアントのサイト(サーバー)情報の引っ越し作業
- Sylpheed( Windows メールクライアント ) で さくらインターネットのメールを IMAP で受信する
- あらためて、XAMPP に入ってる sendmail.exe をバッチファイルから動かして日本語のメールを送信する
- テストにはまだまだ使える(重宝する) AN HTTP Server の正しい使用方法
- PMailServer Version 1.91 フリー版 を Windows10 にインストールして、Windows7 の PHP よりアクセス
- PATH 環境変数メンテナンス : Redmond Path
- Bandicam の静止画を使って、デスクトップキャプチャを効果的に
- UltraVNC : 2014/6/1 現在。ひさしぶりに使ってみて変わっていた事( プロジェクタに特化? )
- プレゼンテーション用のズームソフト「梨ズーム」
- PrimoPDF 日本語版4.1 / 英語版だと、現在 5.1 でした。
- フリーソフト : Autoruns for Windows : 自動起動アプリケーションを一時解除等
- phpMyAdmin(2.11.11.3) のインストール
- net2ftp : すぐ使える為の WEB ベース FTP クライアント
- 解凍ソフト : +Lhaca 1.24 デラックス版の職人的使い方と知識
- Windows7 で動作確認 : 解像度を CTRL + SHIFT + 1、2、3 で切り替える常駐ソフト : Resolution Manager







