2022年5月
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
無料ブログはココログ

« 2010年11月 | トップページ | 2011年1月 »

2010年12月31日 (金)

IE8の履歴の在処(その2)構成

たぶんこんなものじゃないかなぁという仮説です。

親のindex.datはurl+更新日時をユニークキーにタイトル、最終表示日時や利用回数を管理してます。
一方、サブフォルダのindex.datはUIの履歴バーや履歴フォルダ(shell:history)で「日付順に表示」するために後から作ったものです。
親のindex.datだけでは最終表示日時しかないので、「日付順に表示」することができません。表示単位ごとにindex.datが必要なのです。※1

各曜日のindex.datは週末(日曜末)に各週のindex.datに統合集約されます。
また、「ページを履歴で保持する日数」を超えたサブフォルダは削除されます。

一方、親のindex.datは成長を続け、16,187,392 バイトになると、新たな履歴の記録を停止します。※2
インターネットオプションで履歴を削除すれば、新たな履歴の記録が再開しますが、その場合は、過去の履歴がすべて消えます。

履歴バーや履歴フォルダから必要性の低い履歴を削除すれば、index.datからは消えませんが、EnumUrls()などからは消えます。つまり、論理的には削除され、スペースが再利用されるようです。
EnumUrls()に最終表示日時が「ページを履歴で保持する日数」を超えた履歴がないことから、最終表示日時が「ページを履歴で保持する日数」を超えた履歴は論理的には削除され、スペースが再利用されるようです。

※1
歴史的には、キャッシュ、履歴、クッキー、ユーザ別などが物理的に1つのindex.datに入っていたようです。
履歴はVisited:、ユーザ別はusername:、日付順履歴はyyyymmddyyyymmdd:などのプリフィックスをURLに付けて、論理的に分けて使っていたようです。
それがセキュリティなどの理由で別ファイルに分けられたようです。

※2
http://support.microsoft.com/kb/907479/ja
「Internet Explorer 6 を使用して Web サイトにログオンすると、エラー メッセージ "ページを表示できません" が表示される」

2010年12月28日 (火)

IEでJISコードのWebページを表示すると文字化けする。

もし、<META http-equiv=Content-Type content="text/html; charset=iso-2022-jp">
タグがあれば、f5すれば、7bit JISで表示されます。
もし、meta charsetタグがなければ、無理です。IEのエンコーディングのメニューにJISがありません。なんで!

そこを何とか?

もし、スクリプトが有効なら、ブックマークレットやアドレスバーで、

javascript:document.charset='iso-2022-jp';location.reload()

を実行すればよいでしょう。

スクリプトが無効なら、以下のスクリプトを「お気に入りバー」などに入れて実行します。

日本語(JIS).vbs

For Each ie In CreateObject("Shell.Application").Windows()
  On Error Resume Next
  If InStr(LCase(ie.FullName),"iexplore.exe") Then ie.Document.focus:If ie.Document.hasFocus() Then Exit For
  On Error GoTo 0
Next
If Not IsEmpty(ie) Then
  ie.Document.charset="iso-2022-jp"
  ie.Refresh
End If

2010年12月25日 (土)

IE8の履歴の在処

shell:history は、一応、

%USERPROFILE%\AppData\Local\Microsoft\Windows\History

ですが、保護モード有効、整合性レベル低は、

%USERPROFILE%\AppData\Local\Microsoft\Windows\History\Low

保護モード無効、整合性レベル中は、

%USERPROFILE%\AppData\Local\Temp\History

にあります。

後者はエクスプローラで開けますが、前者は無理なようです。

それぞれの下に、

\History.IE5\index.dat

\History.IE5\MSHist01yyyymmddyyyymmdd\index.dat
が今週分の月曜から日曜までの各曜日から翌日まで、月曜から次の月曜までの各週(先週、2 週間前、…)最大、インターネットオプションの「ページを履歴で保持する日数」まであります。
(「ページを履歴で保持する日数」-7)÷7+(1~7) 個

サブフォルダに隠し+システム属性が付いていないものはゴミです。

2010年12月21日 (火)

バッチファイルや関連付けでフォルダの詳細表示を保存印刷する。

Shell.Applicationを使えば、エクスプローラと同じ情報が得られます。

バッチファイルにフォルダをドロップします。あるいはバッチファイルをSendToフォルダに入れておいて、フォルダを送ります。

ps-shell-ie.cmd フォルダパス

powershell.exe "$ie=new-object -com internetexplorer.application;$ie.visible=$true;$ie.toolbar=$false;$ie.navigate('about:blank');$html=((new-object -com shell.application).namespace('%~1').items()|convertto-html -title '$%~1' -property Name,Size,ModifyDate,Type|out-string);try{$ie.document.write($html)}catch{$ie.document.IHTMLDocument2_write($html)}"
 
ファイルフォルダのコンテキストメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\shell\ps-shell-ie\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \"$ie=new-object -com internetexplorer.application;$ie.visible=$true;$ie.toolbar=$false;$ie.navigate('about:blank');$html=((new-object -com shell.application).namespace('%1').items()|convertto-html -title '$%1' -property Name,Size,ModifyDate,Type|out-string);try{$ie.document.write($html)}catch{$ie.document.IHTMLDocument2_write($html)}\"

ファイルフォルダのバックグラウンドメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\Background\shell\ps-shell-ie\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \"$ie=new-object -com internetexplorer.application;$ie.visible=$true;$ie.toolbar=$false;$ie.navigate('about:blank');$html=((new-object -com shell.application).namespace('%v').items()|convertto-html -title '$%v' -property Name,Size,ModifyDate,Type|out-string);try{$ie.document.write($html)}catch{$ie.document.IHTMLDocument2_write($html)}\"

右クリックで「印刷」、「ソースの表示」で保存できます。

※ IEウィンドウがアクティブになれず、バックグラウンドで点滅します。

2010年12月20日 (月)

バッチファイルや関連付けでフォルダの詳細表示相当+フォルダサイズを保存印刷する。

ieに表示すれば、右クリックで「印刷」、「ソースの表示」で保存できます。

fsoだとフォルダサイズに全ファイルサイズが表示されます。

バッチファイルにフォルダをドロップします。あるいはバッチファイルをSendToフォルダに入れておいて、フォルダを送ります。

ps-fso-ie.cmd フォルダパス

powershell.exe "$ie=new-object -com internetexplorer.application;$ie.visible=$true;$ie.toolbar=$false;$ie.navigate('about:blank');$f=(new-object -com scripting.filesystemobject).getfolder('%~1');$html=($f.subfolders+$f.files|convertto-html -title '%~1' -property Name,Size,DateLastModified,Type|out-string);try{$ie.document.write($html)}catch{$ie.document.IHTMLDocument2_write($html)}"
 
ファイルフォルダのコンテキストメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\shell\ps-fso-ie\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \"$ie=new-object -com internetexplorer.application;$ie.visible=$true;$ie.toolbar=$false;$ie.navigate('about:blank');$f=(new-object -com scripting.filesystemobject).getfolder('%1');$html=($f.subfolders+$f.files|convertto-html -title '%1' -property Name,Size,DateLastModified,Type|out-string);try{$ie.document.write($html)}catch{$ie.document.IHTMLDocument2_write($html)}\""

ファイルフォルダのバックグラウンドメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\Background\shell\ps-fso-ie\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \"$ie=new-object -com internetexplorer.application;$ie.visible=$true;$ie.toolbar=$false;$ie.navigate('about:blank');$f=(new-object -com scripting.filesystemobject).getfolder('%v');$html=($f.subfolders+$f.files|convertto-html -title '%v' -property Name,Size,DateLastModified,Type|out-string);try{$ie.document.write($html)}catch{$ie.document.IHTMLDocument2_write($html)}\""

※ IEウィンドウがアクティブになれず、バックグラウンドで点滅します。

2010年12月19日 (日)

バッチファイルや関連付けでフォルダの詳細表示相当+フォルダサイズを表示する。

表示だけならPowerShellのOut-GridViewが使えます。

fsoだとフォルダサイズに全ファイルサイズが表示されます。

バッチファイルにフォルダをドロップします。あるいはバッチファイルをSendToフォルダに入れておいて、フォルダを送ります。

ps-fso-gv.cmd フォルダパス

powershell.exe -windowstyle hidden -command "$f=(new-object -com scripting.filesystemobject).getfolder('%~1');$f.subfolders+$f.files|select -property Name,Size,DateLastModified,Type|out-gridview -title '%~1';while([System.Diagnostics.Process]::GetCurrentProcess().MainWindowHandle -ne 0){start-sleep 1}"
 
ファイルフォルダのコンテキストメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\shell\ps-fso-gv\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -windowstyle hidden -command \"$f=(new-object -com scripting.filesystemobject).getfolder('%1');$f.subfolders+$f.files|select -property Name,Size,DateLastModified,Type|out-gridview -title '%1';while([System.Diagnostics.Process]::GetCurrentProcess().MainWindowHandle -ne 0){start-sleep 1}\""

ファイルフォルダのバックグラウンドメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\Background\shell\ps-fso-gv\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -windowstyle hidden -command \"$f=(new-object -com scripting.filesystemobject).getfolder('%v');$f.subfolders+$f.files|select -property Name,Size,DateLastModified,Type|out-gridview -title '%v';while([System.Diagnostics.Process]::GetCurrentProcess().MainWindowHandle -ne 0){start-sleep 1}\""

※ PowerShellが終了するとウィンドウも閉じるので、-windowstyle hidden コンソールを非表示にして、while([System.Diagnostics.Process]::GetCurrentProcess().MainWindowHandle -ne 0){start-sleep 1} 待ち合わせします。

2010年12月17日 (金)

powershellの中でウィンドウアプリにパイプするとデータが重複する?

再現手順

powershell "type .\in.txt|wscript.exe readall.js" >out.txt

ここで、readall.jsは、

new ActiveXObject("scripting.filesystemobject").getstandardstream(1).write(new ActiveXObject("scripting.filesystemobject").getstandardstream(0).readall())

入力データは8kb。
出力は入力データの後に入力データの4kb以降のデータが続く。

原因

パイプのバッファサイズは4kb?
入力のeofでパイプバッファ上のデータをクリアせずにまた渡している?

回避方法

コンソールアプリに化かす。

powershell "type .\in.txt|cmd.exe /c wscript.exe readall.js" >out.txt

2010年12月16日 (木)

関連付けでフォルダの詳細表示相当を保存印刷する。(その2)

PowerShellでFileSystemObjectのフォルダ情報をhtml tableに変換してhtaに表示します。

fsoだとフォルダサイズに全ファイルサイズが表示されます。

ファイルフォルダのコンテキストメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\shell\ps-fso-hta\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \"$outputencoding=[text.encoding]::getencoding('shift_jis');$f=(new-object -com scripting.filesystemobject).getfolder('%1');$f.subfolders+$f.files|convertto-html -title '%1' -property Name,Size,DateLastModified,Type|cmd.exe /c start /b mshta.exe 'about:<script defer>document.write(new ActiveXObject(\"\"\"scripting.filesystemobject\"\"\").getstandardstream(0).readall());</script>'\""

ファイルフォルダのバックグラウンドメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\Background\shell\ps-fso-hta\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \"$outputencoding=[text.encoding]::getencoding('shift_jis');$f=(new-object -com scripting.filesystemobject).getfolder('%v');$f.subfolders+$f.files|convertto-html -title '%v' -property Name,Size,DateLastModified,Type|cmd.exe /c start /b mshta.exe 'about:<script defer>document.write(new ActiveXObject(\"\"\"scripting.filesystemobject\"\"\").getstandardstream(0).readall());</script>'\""

htaの右クリックで「印刷」、「ソースの表示」で保存。

※ $outputencoding=[text.encoding]::getencoding('shift_jis'); は文字化けを防止します。

2010年12月15日 (水)

関連付けでフォルダの詳細表示相当を保存印刷する。

PowerShellのdir結果をhtml tableに変換してhtaに表示します。

ファイルフォルダのコンテキストメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\shell\ps-dir-hta\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \"$outputencoding=[text.encoding]::getencoding('shift_jis');dir '%1'|convertto-html -title '%1' -property Mode,Name,Length,LastWriteTime,Attributes|cmd.exe /c start /b mshta.exe 'about:<script defer>document.write(new ActiveXObject(\"\"\"scripting.filesystemobject\"\"\").getstandardstream(0).readall());</script>'\""

ファイルフォルダのバックグラウンドメニューに関連付け

[HKEY_CLASSES_ROOT\Directory\Background\shell\ps-dir-hta\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \"$outputencoding=[text.encoding]::getencoding('shift_jis');dir '%v'|convertto-html -title '%v' -property Mode,Name,Length,LastWriteTime,Attributes|cmd.exe /c start /b mshta.exe 'about:<script defer>document.write(new ActiveXObject(\"\"\"scripting.filesystemobject\"\"\").getstandardstream(0).readall());</script>'\""

htaの右クリックで「印刷」、「ソースの表示」で保存。

※ $outputencoding=[text.encoding]::getencoding('shift_jis'); は文字化けを防止します。

2010年12月14日 (火)

バッチファイルでフォルダの詳細表示相当を保存印刷する。

バッチファイルにフォルダをドロップします。あるいはバッチファイルをSendToフォルダに入れておいて、フォルダを送ります。

PowerShellのdir結果をhtml tableに変換してhtaに表示します。

ps-dir-hta.cmd フォルダパス

powershell "dir '%~1'|convertto-html -title '%~1' -property Mode,Name,Length,LastWriteTime,Attributes|write-host"|start /b mshta.exe "about:<script defer>document.write(new ActiveXObject('scripting.filesystemobject').getstandardstream(0).readall());</script>"

PowerShellでFileSystemObjectのフォルダ情報をhtml tableに変換してhtaに表示します。

ps-fso-hta.cmd フォルダパス

powershell "$f=(new-object -com scripting.filesystemobject).getfolder('%~1');$f.subfolders+$f.files|convertto-html -title '%~1' -property Name,Size,DateLastModified,Type|write-host"|start /b mshta.exe "about:<script defer>document.write(new ActiveXObject('scripting.filesystemobject').getstandardstream(0).readall());</script>"

fsoだとフォルダサイズに全ファイルサイズが表示されます。

PowerShellでShell.Applicationのフォルダ情報をhtml tableに変換してhtaに表示します。

ps-shell-hta.cmd フォルダパス

powershell "(new-object -com shell.application).namespace('%~1').items()|convertto-html -title '%~1' -property Name,Size,ModifyDate,Type|write-host"|start /b mshta.exe "about:<script defer>document.write(new ActiveXObject('scripting.filesystemobject').getstandardstream(0).readall());</script>"

Shell.Applicationを使えば、エクスプローラと同じ情報が得られます。

htaの右クリックで「印刷」、「ソースの表示」で保存。

※ write-host は途中改行を防止します。

2010年12月13日 (月)

フォルダの表示設定の保存場所はどこか?

各フォルダの表示形式、カラム、ソートなどは、以下のレジストリに保存されていますが、

HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\数字\Shell\{フォルダタイプ}

この数字、{フォルダタイプ}とフォルダの対応が取れないとどうしようもありません。

そこで、フォルダをWhereIsFolderSettings.vbsにドロップします。
フォルダパス名を省略すると、開いているフォルダの中から選択します。
保存場所が見つかると、その場所(レジストリキー)と適用されているフォルダタイプの名前を表示します。

WhereIsFolderSettings.vbs [フォルダパス名]

Option Explicit
Const HKCU=&H80000001
Dim Path
Dim ie
Dim Shell
Dim wShell
Dim Modes
Dim SubKeys
Dim oReg
Dim k,j
Dim SubSubKeys
Dim Mode
Dim SubKey
Dim CurrentViewMode

If WScript.Arguments.Count Then
  Path=WScript.Arguments.Item(0)
  Set ie=GetObject("new:{C08AFD90-F2A1-11D1-8455-00A0C91F3880}")
'  ie.Visible=True
  ie.Navigate Path
  Do While ie.Busy Or ie.ReadyState<>4
    WScript.Sleep 100
  Loop
Else
  Set Shell=CreateObject("Shell.Application")
  For Each ie In Shell.Windows
    If InStr(LCase(ie.FullName),"explorer.exe") Then
      If MsgBox(ie.LocationURL,1,"Which folder to get ID of ?")=1 Then Exit For
    End If
  Next
  If IsEmpty(ie) Then WScript.Quit
End If
Set wShell=CreateObject("WScript.Shell")
Set Modes=CreateObject("Scripting.Dictionary")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
oReg.EnumKey HKCU,"Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\",SubKeys
For k=0 To UBound(SubKeys)
  oReg.EnumKey HKCU,"Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\" & SubKeys(k) & "\Shell\",SubSubKeys
  If IsArray(SubSubKeys) Then
  For j=0 To UBound(SubSubKeys)
    Mode=RegRead("HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\" & SubKeys(k) & "\Shell\" & SubSubKeys(j) & "\Mode")
    If Mode Then Modes.Add SubKeys(k) & "\Shell\" & SubSubKeys(j),Mode
  Next
  End If
Next
CurrentViewMode=ie.Document.CurrentViewMode
ie.Document.CurrentViewMode=CLng(CurrentViewMode) mod 2 +3
ie.Refresh
For Each SubKey In Modes
  Mode=RegRead("HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\" & SubKey & "\Mode")
  If Mode Then If Modes(SubKey)<>Mode Then WScript.Echo Join(Array("HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\" & SubKey,RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\FolderTypes\"& Split(SubKey,"\")(2) & "\CanonicalName")),vbLf)
Next
ie.Document.CurrentViewMode=CurrentViewMode
If WScript.Arguments.Count Then
  ie.Quit
Else
  ie.Refresh
End If

Function RegRead(Key)
On Error Resume Next
RegRead=wShell.RegRead(Key)
End Function

2010年12月11日 (土)

スクリプトでcsvファイルを整形する。(その3)

powershell には、import-csv と export-csv があるので、

import-csv .\in.csv | export-csv .\out.csv -notype

とすればよさそうなものですが、import-csv はヘッダ有りがデフォルトで、ヘッダなしの場合、事前にカラム数を知って、-headerでヘッダを付けなければなりません。

例えば、4カラムなら、

import-csv -header (1..4)

みたいに。あ~面倒。

2010年12月10日 (金)

スクリプトでcsvファイルを整形する。(その2)

すべての値を、空の値も、""で囲んで、標準出力に出します。
× aaa,b b,,"ddd","e e"
○ "aaa","b b","","ddd","e e"

cscript csvfix.vbs 入力ファイル

Option Explicit
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Dim fso
Dim Path
Set fso=CreateObject("Scripting.FileSystemObject")
For Each Path In WScript.Arguments
  Call CSV(fso.GetAbsolutePathName(Path))
Next

Sub CSV(Path)
Dim CN
Dim RS
Dim Items
Dim k
Dim Value
Set CN = createobject("ADODB.Connection")
Set RS = createobject("ADODB.Recordset")
CN.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & fso.GetParentFolderName(Path) & "\;Extended Properties=""text;HDR=NO;FMT=Delimited"""
RS.open "SELECT * FROM " & fso.GetFileName(Path) ,CN, adOpenStatic, adLockOptimistic, adCmdText
ReDim Items(RS.Fields.Count-1)
'For k=0 To RS.Fields.Count-1
'  Items(k)=Chr(34) & RS.Fields.Item(k).Name & Chr(34)
'Next
'WScript.Echo Join(Items,",")
Do While Not RS.EOF
  For k=0 To RS.Fields.Count-1
    Value=RS.Fields.Item(k).Value
    If IsNull(Value) Then Value=Empty
    Items(k)=Chr(34) & Value & Chr(34)
  Next
  WScript.Echo Join(Items,",")
  RS.MoveNext
Loop
RS.Close
CN.Close
End Sub

ヘッダのないCSVにヘッダを自動生成するには、コメントアウトを外す。

2010年12月 8日 (水)

スクリプトでcsvファイルを整形する。

すべての値を、空の値も、""で囲んで、標準出力に出します。
× aaa,b b,,"ddd","e e"
○ "aaa","b b","","ddd","e e"

cscript csvfix.vbs 入力ファイル

Option Explicit
Dim Path
For Each Path In WScript.Arguments
  csvfix Path
Next

Sub CSVFix(Path)
Dim fso
Dim File
Dim Line
Set fso=CreateObject("Scripting.FileSystemObject")
Set File=fso.OpenTextFile(Path)
Do While Not File.AtEndOfStream
  Line=File.ReadLine()
  WScript.StdOut.WriteLine Fix(Line)
Loop
End Sub

Function Fix(Line)
Dim fQuoting
Dim chars
Dim k
Dim char

ReDim chars(Len(Line)-1)
fQuoting=False
For k=1 To Len(Line)
  char=Mid(Line,k,1)
  If char=Chr(34) Then fQuoting=Not fQuoting
  If char=Chr(44) Then If Not fQuoting Then char=vbNullChar
  chars(k-1)=char
Next
chars=Split(Join(chars,Empty),vbNullChar)
For k=0 To UBound(chars)
  chars(k)=Chr(34) & Replace(chars(k),Chr(34),Empty) & Chr(34)
Next
Fix=Join(chars,Chr(44))
End Function

hta.commandLineのパーズ用スクリプトをベースに、空白区切りをコンマ区切りに、連続区切りを分離に変えてます。

2010年12月 7日 (火)

バッチファイルでcsvファイルを整形する。

すべての値を、空の値も、""で囲みます。
× aaa,b b,,"ddd","e e"
○ "aaa","b b","","ddd","e e"

csvfix.cmd 入力ファイル [出力ファイル]

@echo off
setlocal enabledelayedexpansion
set out=%2
for /f "delims=" %%L in (%1) do call :sub %%L
goto :eof

:sub
set line=%*
set fq=
set fg=
set fb=true
set line2=
set n=0
if not defined line goto :next
:for
  set c=!line:~%n%,1!
  if not defined c goto :next
  if defined fq (
    if !c!==^" set fq=& if defined fg set line2=!line2!^"
  ) else (
    if !c!==^, if not defined fb (
      set fb=true
      if defined fg (
        set fg=
        set line2=!line2!^"
      )
    ) else (
      set line2=!line2!^"^"
    )
    if not !c!==^, if defined fb (
      set fb=
      if not !c!==^" (
        set fg=true
        set line2=!line2!^"
      )
    )
    if !c!==^" set fq=true& if defined fg set line2=!line2!^"
  )
  set line2=!line2!!c!
  set /a n+=1
  goto :for
:next
if defined fq set line2=!line2!^"& if defined fg set line2=!line2!^"
if defined fg set line2=!line2!^"
if defined out (
  echo;!line2!>>out
) else (
  echo;!line2!
)
goto :eof

出力ファイルを省略すると標準出力へ。

バッチ引数が全角空白で区切られるバグへの対策用のバッチファイルを、空白区切りをコンマ区切りに、連続区切りを分離に変えただけです。
http://scripting.cocolog-nifty.com/blog/2009/02/post-1fb0.html

2010年12月 6日 (月)

explorer.exeの/n,/eスイッチ

「整理」「レイアウト」で「ナビゲーションペイン」を表示すると、explorer.exeのスイッチに関係なく表示されます。

「整理」「レイアウト」で「ナビゲーションペイン」を非表示にしておけば、explorer.exeの/n,/eスイッチが効きます。
/n - ナビゲーションペイン非表示
/e - ナビゲーションペイン表示

explore.exeのデフォルトは/eで、/rootのデフォルトは/nのようです。

関連付け動詞のopenやexplore、コンテキストメニューの「開く」や「エクスプローラ」でも制御できます。
open/開く - ナビゲーションペイン非表示
explore/エクスプローラ - ナビゲーションペイン表示

ただし、この制御が有効なのは新しいウィンドウを開くときだけです。フォルダを同じウィンドウで開くと、「整理」「レイアウト」の設定に戻ってしまします。

なので、結局、これは使えません。支離滅裂な仕様ですね。

2010年12月 5日 (日)

関連付けで最大化を指定する。

cmd.exe /c start /max "dummytitle" "%1" %*

コンソールが一瞬開きますが、最大化の場合はあまり気にならないのでは?

最小化の場合は、cmdw.exeのほうがよいでしょう。

2010年12月 4日 (土)

explorer.exe /root,は変です。使わない方がよい。

ナビゲーションバーを浅くしようと、フォルダへのショートカットにexplorer.exe /root,を付けると、いろいろ不具合が出ます。

「新規作成」してもエクスプローラのフォルダペインに即時に反映されない。「最新の情報に更新」すれば見えますが。。。

フォルダを別ウィンドウで開くと、そのフォルダがルートになる。

2010年12月 3日 (金)

エクスプローラの詳細表示に背景がないとき

背景がなくても、ドロップするときは、タイトルバー、詳細ペイン、ステータスバーにドロップできるし、バックグラウンドメニューを使うときもファイルメニューなどが使えるので、特に困りませんが。。。
ただ、選択を解除するときは、背景がないと面倒です。

一番下にスクロールした状態で、下縁を下にドラッグして1行未満幅だけ広げると最下行の下に1行未満幅の背景ができます。

2010年12月 2日 (木)

保護モード有効の「ファイルを開く」ダイアログの右クリックがハングする障害が修正された。

Vista+IE8の保護モード有効で、IEの「開く」-「参照」や<input type=file>のOpen Fileダイアログで、右クリックメニューで起動しようとすると、「Internet Explorer セキュリティ」「Web サイトで、このプログラムを使って Webコンテンツを開こうとしています」が出て、ハングしてましたが、最近のWindows updatesで修正されたようです。

これで、「ファイルを開く」ダイアログを保護モード有効(整合性レベル低)のエクスプローラ代わりに安心して使うことができます。

2010年12月 1日 (水)

フォルダの「総ファイルサイズ」と「ファイル数」カラムに値を設定、表示する。

エクスプローラには「総ファイルサイズ」と「ファイル数」カラムがありますが、それらを表示しても、値が表示されません。
実装されてないからです。

しかし、フォルダのdesktop.iniファイルに、

[{28636AA6-953D-11D2-B5D6-00C04FD918D0}]
Prop12=21,1
Prop14=21,1

を追加すれば、それぞれ1ファイル、1KBと表示されます。

スクリプトなどで、定期的または随時、計算して設定してやればよいのです。

レジストリで、

[HKEY_CLASSES_ROOT\Directory]
"PreviewDetails"="prop:System.DateModified;*System.SharedWith;*System.OfflineAvailability;*System.OfflineStatus;;*System.FileCount;*System.TotalFileSize"

のように、*System.FileCountと*System.TotalFileSizeを追加すれば、詳細ペインにも表示されます。
*は値があるときだけ表示します。これらは。コメントやタグとは違って、表示だけです。変更はできません。

« 2010年11月 | トップページ | 2011年1月 »