
目次 >> Windows Tips
ここでは、Windowsのきわめて初歩的なものも含めたTipsをQ&A形式で記述する。
商用SSH(学術機関などではフリーで使えるバージョンが公開されている)とOpenSSHでは鍵を変換しないと使えない。まず、クライアント側Windowsのコマンドプロンプトで、公開鍵を以下の要領で作成する。
C:\>ssh-keygen2 -t rsa
Generating 2048-bit rsa key pair
5 oOo.oOo.oOo.
Key generated.
2048-bit rsa, foo@BAB4380083, Fri Apr 07 2006 05:28:47
Passphrase :
Again :
Key is stored with NULL passphrase.
(You can ignore the following warning if you are generating hostkeys.)
This is not recommended.
Don't do this unless you know what you're doing.
If file system protections fail (someone can access the keyfile),
or if the super-user is malicious, your key can be used without
the deciphering effort.
Private key saved to C:/Documents and Settings/foo/Application Data/SSH/UserKeys/id_rsa_2048_a
Public key saved to C:/Documents and Settings/foo/Application Data/SSH/UserKeys/id_rsa_2048_a.pub
できたid_rsa_2048_a.pubをサーバ側のLinuxに持って行く(この際に、UserKeysフォルダ内のid_rsa_2048_a.pubを消さないこと。id_rsa_2048_aおよびid_rsa_2048_a.pubの両方がUserKeysフォルダ内に存在していないといけない。)。これを次のコマンドで変換する。
$ ssh-keygen -i -f id_rsa_2048_a.pub > id_rsa_2048_a_openssh.pub
これで、id_rsa_2048_a_openssh.pubはOpenSSHで使える公開鍵に変換された。この内容を、$HOME/.ssh/authorized_keysに追加してやると、商用SSHから、パスワードなしでアクセスできるようになる。
なお、同様に、商用SSHの秘密鍵をOpenSSHで使える形式に変換するには、
$ ssh-keygen -i -f id_rsa_2048_a > id_rsa
とする。そしてid_rsaを自分のホームディレクトリ上にある.sshに移動して、アクセス権を600にする。
ファイル名は必ずir_rsaとすること。(id_rsa_2048_a_openssh等にすると、うまくいかない)
Windows Updateを適用すると、再起動するよう促すダイアログが定期的に表示される。
この際に、停止できないプログラムを走らせていたなど、すぐに再起動したくない場合がある。
その場合は、書きのようにダイアログの表示を停止すればよい。
コントロールパネル内の、管理ツールの中にあるサービスという項目をクリックする。
その中に、Automatic Updatesという項目があるので、それを停止すれば、以後再起動するまで、このダイアログは表示されなくなる。
なお、再起動すれば、再びWindows Updateは有効になるので問題ない。
TuneXPを使う。
c:\cygwin\binにパスを通す。これでlsなどのコマンドが使えるようになる。
C:\cygwin\usr\X11R6\bin\startxwin.batの中の
%RUN% xterm -e /usr/bin/bash -l
とある行を削除、もしくはコメントアウトして実行します。これで、このバッチファイルがWindows開始時に実行されるようにしておけば、常にsshやOpenDXなどからXWindowを呼び出すことができる。具体的には、
@echo off SET DISPLAY=127.0.0.1:0.0 REM REM The path in the CYGWIN_ROOT environment variable assignment assume REM that Cygwin is installed in a directory called 'cygwin' in the root REM directory of the current drive. You will only need to modify REM CYGWIN_ROOT if you have installed Cygwin in another directory. For REM example, if you installed Cygwin in \foo\bar\baz\cygwin, you will need REM to change \cygwin to \foo\bar\baz\cygwin. REM REM This batch file will almost always be run from the same drive (and REM directory) as the drive that contains Cygwin/X, therefore you will REM not need to add a drive letter to CYGWIN_ROOT. For example, you do REM not need to change \cygwin to c:\cygwin if you are running this REM batch file from the C drive. REM SET CYGWIN_ROOT=\cygwin SET RUN=%CYGWIN_ROOT%\bin\run -p /usr/X11R6/bin SET PATH=.;%CYGWIN_ROOT%\bin;%CYGWIN_ROOT%\usr\X11R6\bin;%PATH% SET XAPPLRESDIR=/usr/X11R6/lib/X11/app-defaults SET XCMSDB=/usr/X11R6/lib/X11/Xcms.txt SET XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB SET XNLSPATH=/usr/X11R6/lib/X11/locale REM REM Cleanup after last run. REM if not exist %CYGWIN_ROOT%\tmp\.X11-unix\X0 goto CLEANUP-FINISH attrib -s %CYGWIN_ROOT%\tmp\.X11-unix\X0 del %CYGWIN_ROOT%\tmp\.X11-unix\X0 :CLEANUP-FINISH if exist %CYGWIN_ROOT%\tmp\.X11-unix rmdir %CYGWIN_ROOT%\tmp\.X11-unix REM REM The error "Fatal server error: could not open default font 'fixed'" is REM caused by using a DOS mode mount for the mount that the Cygwin/X REM fonts are accessed through. See the Cygwin/X FAQ for more REM information: REM http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-error-font-eof REM if "%OS%" == "Windows_NT" goto OS_NT REM Windows 95/98/Me echo startxwin.bat - Starting on Windows 95/98/Me goto STARTUP :OS_NT REM Windows NT/2000/XP/2003 echo startxwin.bat - Starting on Windows NT/2000/XP/2003 :STARTUP REM Brief descriptions of XWin-specific options: REM REM -screen scr_num [width height] REM Enable screen scr_num and optionally specify a width and REM height for that screen. REM Most importantly, any parameters specified before the first -screen REM parameter apply to all screens. Any options after the first -screen REM parameter apply only to the screen that precedes the parameter. REM Example: REM XWin -fullscreen -screen 0 -screen 1 -depth 8 -screen 2 REM All screens will be fullscreen, but screen 2 will be depth 8, while REM screens 0 and 1 will be the default depth (whatever depth Windows REM is currently running at). REM -multiwindow REM Start an integrated Windows-based window manager. Not to be used REM with -rootless nor -fullscreen. REM -rootless REM Use a transparent root window with an external window manager REM (such as twm). Not to be used with -multiwindow nor REM with -fullscreen. REM -fullscreen REM Use a window as large as possible on the primary monitor. REM -multiplemonitors REM Create a root window that covers all monitors on a REM system with multiple monitors. REM -clipboard REM Enable the integrated version of xwinclip. Do not use in REM conjunction with the xwinclip program. REM -depth bits_per_pixel REM Specify the screen depth to run at (in bits per pixel) using a REM DirectDraw-based engine in conjunction with the -fullscreen REM option, ignored if the -fullscreen option is not specified. REM By default, you will be using a DirectDraw based engine on any REM system that supports it. REM -unixkill REM Trap Ctrl+Alt+Backspace as a server shutdown key combination. REM -nounixkill REM Disable Ctrl+Alt+Backspace as a server shutdown key combination (default). REM Example: REM XWin -unixkill -screen 0 -screen 1 -screen 2 -nounixkill REM Screens 0 and 1 will allow Ctrl+Alt+Backspace, but screen 2 will not. REM -winkill REM Trap Alt+F4 as a server shutdown key combination (default). REM -nowinkill REM Disable Alt+F4 as a server shutdown key combination. REM -scrollbars REM Enable resizing of the server display window. Do not use in conjunction REM with -multiwindow nor with -rootless. REM -nodecoration REM Draw the server root window without a title bar or border. REM Do not use with -mutliwindow nor with -rootless. REM -lesspointer REM Hide the Windows mouse cursor anytime it is over any part of the REM window, even if Cygwin/X is not the window with the focus. REM -refresh rate_in_Hz REM Specify a refresh rate to use when used with the -fullscreen option. REM -trayicon REM Enable the tray icon (default). REM -notrayicon REM Disable the tray icon. REM Example: REM XWin -notrayicon -screen 0 -screen 1 -screen 2 -trayicon REM Screens 0 and 1 will not have tray icons, but screen 2 will. REM -emulate3buttons [timeout] REM Emulate 3 button mouse with an optional timeout in milliseconds. REM -xf86config REM Specify an XF86Config-style configuration file. REM -keyboard REM Specify a keyboard device from the configuration file. REM REM Startup the programs REM REM Startup the X Server with the integrated Windows-based window manager. REM WARNING: Do not use 'xwinclip' in conjunction with the ``-clipboard'' REM command-line parameter for XWin. Doing so would start two clipboard REM managers, which is never supposed to happen. %RUN% XWin -multiwindow -clipboard -silent-dup-error REM Startup an xterm, using bash as the shell. REM %RUN% xterm -e /usr/bin/bash -l REM REM Startup the twm window manager. REM WARNING: Do not use an external window manager in conjunction with REM the ``-multiwindow'' command-line parameter for XWin. Doing so REM would start two window managers, which is never supposed to happen. REM REM %RUN% twm REM Set a background color. Only needed when not using -multwindow for XWin. REM %RUN% xsetroot -solid aquamarine4
という内容のbatファイルを実行すればよい。なお、batファイルは必ずC:\cygwin\usr\X11R6\bin\に置くこと。
WindowsXPで、初期の設定では、オーディオCODECとしてFraunhofer IIS MPEG Layer-3 Codec (adpanced)がインストールされている。このコーデックは、作成できるmp3のビットレートが56kbpsに制限されている。Windows Media Player 10をインストールすると、同時に320kbpsまでのmp3ファイルを作成できるFraunhofer IIS MPEG Layer-3 Codec (professional)がついてくるが、これはレジストリをいじらない限り、Windows Media Player 10以外のソフトからは使えない。Fraunhofer IIS MPEG Layer-3 Codec (professional)を有効にするためには、レジストリエディタで
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32
の中にある、msacm.l3acmという項目をC:\WINDOWS\system32\l3codecp.acmからC:\WINDOWS\system32\l3codecp.acmに変更する。
setup.exeを-qと-dオプションをつけて、cronなどで起動する。-qは確認メッセージを出さない、-dはインターネットからダウンロードするを意味するオプションである。
この際に、デスクトップやスタートメニューにショートカットを作成したくない場合は、下記のオプションを使用する。
-n:デスクトップとスタートメニューの両方に登録しない
-d:デスクトップに登録しない
-N:スタートメニューに登録しない
標準のパッケージに加えて、openssh、rysnc、X11のすべて、imagemagick(opendx用)、g++をインストールしておくと良い。
cygwinではgzipはあるが、gunzipは登録されていない。Linuxなどでもそうであるが、gunzipの実態は、gzipに-dオプションをつけて実行しているだけである。
Windowsの場合は、gunzip.batというファイルを作成して、その内容を
gzip -d %d
として、パスの通っているフォルダにおいてやればよい。
標準のコマンドfcでファイルを比較することができる。以下はfc /?の内容。
2 つのファイルまたはファイル セットを比較し、相違点を表示します。
FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn]
[ドライブ1:][パス1]ファイル名1 [ドライブ2:][パス2]ファイル名2
FC /B [ドライブ1:][パス1]ファイル名1 [ドライブ2:][パス2]ファイル名2
/A 相違する各部分の 1 行目と最後の行だけを表示します。
/B バイナリの比較を実行します。
/C 英字の大文字と小文字を区別しません。
/L ファイルを ASCII テキストとして比較します。
/LBn 連続する最大不一致行を指定行数に設定します。
/N ASCII の比較で行番号を表示します。
/OFF[LINE] オフライン属性が設定されたファイルをスキップしません。
/T タブをスペースに変換しません。
/U Unicode テキスト ファイルとしてファイルを比較します。
/W 連続した空白 (タブとスペース) を 1 つのスペースに圧縮して比較します。
/nnnn 不一致発見後に確認する、一致すべき連続行数を指定します。
[ドライブ1:][パス1]ファイル名1
比較する最初のファイルまたはファイル セットを指定します。
[ドライブ2:][パス2]ファイル名2
比較する 2 番目のファイルまたはファイル セットを指定します。
MD5を算出するにはまずマイクロソフトのサイトからfciv(File Checksum Integrity Verifier utility)というツールをダウンロードしてくる。
File Checksum Integrity Verifier utility
使い方は、
fciv ファイル名
である。
Internet Explorer 7 をインストールすると、CD/DVDドライブ内のファイルのアイコンがすべてIEのアイコンになってしまうことがある。
このような場合は、画面のプロパティで、「大きいアイコンを使用する」のチェックボックスをオフにすればよい。
まず、http://decas-dev.net/からDokan Libraryをインストールする。それから、Visual C++ 2005 SP1 再頒布可能パッケージをインストールし、最後に、Dokan SSHFSをインストールすると、スタートメニューにDokanSSHFSというのができるので、これを実行すると、サーバのディレクトリをWindowsのネットワークドライブとして扱えるようになる。
Gavotte Ramdiskを使って、RAMディスクを作成すると、32bit Windowsでもすべてのメモリを有効に活用できる。
まず、ram4g.regを実行する。
次に、ramdisk.exeを実行し、サイズを指定する。
ここで指定したサイズがOS領域外メモリのサイズより少ない場合は、OS領域外すべてがRAMディスクに割り当てられる。
shutdownコマンドを使う。
MEncoderはフリーのビデオおよびオーディオの圧縮を行うエンコーダである。コマンドラインから操作できるため、スクリプトなどによる自動化や他ソフトの連携が容易である。
ここでは2つのことについて解説する。
一つは、無圧縮AVIファイルから、圧縮されたAVIファイルを作成する方法、もう一つは、複数のJPEGファイルからAVIファイルを作成する方法である。
インストール
パスを通しておく。
無圧縮AVIから圧縮AVIの作成
Windowsでデフォルトで再生でき、かつ圧縮率も比較的高いのは、MS MPEG4v2である。そこで、vcodecの値は、
vcodec=msmpeg4v2
とする。
この値が小さいとブロックノイズが出る。デフォルトでは2であるが、ブロックノイズが出るので普段は4を指定している。
キーフレームの挿入間隔である。デフォルト値は250。
複数回エンコードを行うことにより、1回で行うよりもきれいな動画を生成することができる。基本的には2回で動画を生成する2passエンコーディングがお薦めである。3pass以上も可能であるが、差はきわめて小さい。
2passで行う場合、まず、1回目はvpass=1を指定して、エンコードを行う。これにより元動画の統計が取られる。
2回目はvpass=2を指定しエンコードを行う。これにより、1回目の統計を元に最適な動画が生成される。
この値はビットレートを設定する。大きな値ほどきれいな動画になるが、ファイルサイズはその分大きくなる。4-16000を指定した場合は、kbitとなり、16001-24000000の値を指定した場合は、単位はbitになる。デフォルトの値は800kbitである。
通常、Active Directoryを使うとそのドメインコントローラと時刻の同期が取られる。
コマンドラインで次のように打ち込むと、ドメインコントローラの変わりに、外部のNTPサーバと時刻の同期を取ることができる。
> w32tm /config /syncfromflags:MANUAL /manualpeerlist:ntp.nict.jp
ntp.nict.jpのの部分は、あわせたいNTPサーバに書き換える。
元に戻すには、
> w32tm /config /syncfromflags:DOMHIER
とコマンドラインで打つ。
自動再生を完全にとめるには[スタート][ファイル名を指定して実行]でgpedit.mscと打ち、[コンピュータの構成][管理用テンプレート][システム]の中の、[自動再生機能をオフにする]を選択し、[プロパティ]を選び、[有効]、[すべてのドライブ]を選ぶ。
Excel 2003で起動時などに、「VBA ライブラリ (1004) の初期化でエラーが発生しました。」というエラーが表示される場合は、VBAをインストールすると解消される。
Google Chromeでデータフォルダやキャッシュフォルダはデフォルトでは、C:\Documents and Settings下のユーザーフォルダに作成される。このの場所を変更するには、起動オプションを指定して変更する。
ユーザーデータフォルダを変更するには、
--user-data-dir="d:\hogehoge"
と指定する。通常はこの中にキャッシュフォルダも作成される。
キャッシュフォルダの場所のみを変更したい場合は、
--disk-cache-dir="d:\piyopiyo"
のように指定する。
--disk-cache-size=1000000000 --media-cache-size=1000000000
これで、キャッシュサイズを指定することができる。単位はbyteで上記の場合は、1GBを指定している。なおmedia-cacheというのはビデオファイルなどのことである。
ディスクキャッシュを止めるには、0バイトを指定しても無視されるので
--disk-cache-size=1 --media-cache-size=1
1バイトを指定すれば、事実上ディスクキャッシュは使われない。
ダウンロードしたファイルを
wmp11-windowsxp-x86-JA-JP.exe /c /t:解凍先フォルダ
で解凍。解凍先にあるwmfdist11.exeを実行しWindows Media Format 11 Runtime をインストールする。再起動した後、wmp11.exe を実行し、Windows Media Player 11をインストールする。
より高機能なPDFビューアを持っている場合、Chrome内蔵のPDFビューアを無効にしたい場合がある。
手順は下記の通り。
まず、アドレスバーに、
about:plugins
と入力する。すると、現在インストールされているプラグインの一覧が出てくるので、
Chrome PDF Viewer
という項目を見つけ、直下のdisableと書かれたリンクをクリックする。
コントロールパネルの画面の設定で、スタイルとクラシックスタイルを一旦WindosXP標準のスタイルに戻す。その後、もう一度、クラシックスタイルに戻すと、正常に戻っている。
PowerPointでJPEGやTIFFなどで保存すると、解像度の比較的小さいファイルとして出力される。
通常の状態では、960X720ピクセルである。これを変更するには、レジストリエディタで
PowerPoint 2003であれば
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\PowerPoint\Options
PowerPoint 2007であれば
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\PowerPoint\Options
にDWORDで「ExportBitmapResolution」というキーを作成し、307という数値を入れる。
すると3072x2304ピクセルで、画像が出力されるようになる。
ExportBitmapResolutionの値のおおよそ10倍の値が、横解像度となる。
なお307が最大値であるのでこれ以上大きな値を入れても解像度は高くならない。
スタンドアローンインストーラはここからダウンロードできる
Internet Explorer用(ActiveX)
それ以外