Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Windows

コンボボックスとかドロップダウンリストとかプルダウンリストとか

コンボボックスとかドロップダウンリストとかプルダウンリストとか言われるものが何を指しているか、ドキュメントごとに違うように見えるので調べてみた。 ドロップダウンリストの例 Windows User Experience Interaction Guidelines *1 "standard list box"…

Way to shutdown Windows

There are so many ways to shutdown Windows: # How to shutdown What is executed Wait for HungAppTimeout 1 shutdown from Start Menu RuntimeBroker.exe Yes 2 shutdown from the lock screen winlogon.exe No 3 execute SlideToShutDown.exe SlideToSh…

Windowsをシャットダウンする方法いろいろ

Windowsをシャットダウンする方法には スタートメニューから「シャットダウン」を選択(内部的にはC:\Windows\System32\RuntimeBroker.exeが呼ばれているみたい) デスクトップでAlt+F4を押して「シャットダウン」を選択 ロック画面から「シャットダウン」を…

間欠動作するアプリケーションむけActive Directoryアクセストークンの保存方法の検討

OutlookやSharePointのAPI、バックグラウンドのアプリケーションで使おうとするとすぐ管理者の同意が必要なPermissionを求めてくる。 たとえばバックグラウンドアプリから自分のOneDriveへファイルをアップロードしたい場合、Azure Active DirectoryでFiles.…

EdgeのIEモードはIEなのか?

Windows 11 Pro 21H2 (22000.282)で確認。 Microsoftは何と言っているか? 「従来のサイトには、Internet Explorer 11 (IE11) から Trident MSHTML エンジンを使用します」と言っている*1。IEモードはIE 11であると言える。 WindowsからIE 11をアンインスト…

Record the mouse position and the top window title to Windows Event Log

Requirement Record the user activity to Windows Event Logs. The mouse position*1 and top window title *2 are used to indicate the activity. Solution Run the following PowerShell script every 5 minutes from the Task Scheduler. Add-Type -Ass…

Record a Windows Event Log with a custom application/source and appropriate message

Requirement You want to record an event on Windows Event Log. The log should be recorded with a custom application and source. The message of the event should be recorded appropriately. The message should not contain the warning like The d…

You cannot show fullscreen message and log-off after a time-out with shutdown.exe

Background You can log off from Windows with shutdown.exe. Requirement You want to log off from Windows at the specified time. It should not be shut down after the log-off. You want to show a fullscreen message 5 minutes before the log-off…

Windows Event Viewer Category Correspondence Table

I couldn't find the correspondence table between the value of the -Category argument (Int16) of Write-EventLog cmdlet and the category shown in Event Viewer from Microsoft. I have run this command and viewed the result in the Event Viewer …

OneDriveをリポジトリとしてファイルのバージョン管理を行う方法の案

個人的な作業の成果物の管理用に、ローカルストレージやファイル共有にバージョン管理システムのリポジトリを作っていたが、それをOneDriveに移さないといけない……というケースに対する予備調査。「Subversion」は任意のバージョン管理ソフトウェアの名前に…

ウィンドウ右下のサイズ変更用エリアの名前

Windowsのメモ帳のステータスバー右下なんかに表示されてるコレの名前、ドキュメントによって呼び名が違う。 MFCのAPIリファレンスだと "gripper" と呼ばれている。Prof-UISでもgripperと呼んでいる。 .NETのAPIリファレンスだと "sizing grip" と呼ばれてい…

外部プロセスとしてシェルスクリプトを起動する方法

任意の処理系から外部プロセスとしてシェルスクリプトを起動したい場合、大きく以下の2つの方法が考えられます。 (1) shの引数にシェルスクリプトを指定する /bin/sh foobar.sh のように、shの引数にシェルスクリプトを指定して起動する。 shに与えるパラメ…

Overwriting existing file never change creation time in NTFS

Overwriting existing file like 1..10 > file.txt, 1..10 | Out-File file.txt, or 1..10 | Set-Content file.txt, never changes creation time in NTFS. You have to delete the file explicitly like rm file.txt; 1..10 > file.txt, or change creation…

TFTPでファイルのリクエストがタイムアウトになる

背景 デバイスのブート時にイメージをTFTPで流しこみたい。 TFTPで通信する際、デバイスのIPアドレスは192.168.11.1、TFTPサーバは192.168.11.168で固定になっている。 TFTPサーバにはWindows 10上のPumpKINを使っている。 PumpKINの設定で、リクエスト・レ…

Microsoft Print to PDFで出力したPDFファイルが0バイトになる問題を回避する

大きなPDFファイルを複数に分割しようと思って、Adobe ReaderからMicrosoft Print to PDFへ印刷してみたんだけど、できあがるPDFファイルが0バイトで、正常に出力されない。 Wordでも同じ現象が起こったので、これはMicrosoft Print to PDFの問題かな?と思…

cmd.exeとPowerShellの起動速度

体感ではPowerShellの起動速度はcmd.exeと比べて明らかに遅いけれど、具体的にどの程度遅いのか確かめてみた。 OSはWindows 10 version 2004、CPUはIntel(R) Core(TM) i7-8750H CPU @ 2.20GHz(6コア12スレッド)です。 なお、処理に使うウィンドウはPowerSh…

VM上のUbuntuとWSL2上のUbuntuの違い

WSL2が入ったのでUbuntuを入れてみた。主にsystemdの不在に伴って、VM上のUbuntuとはいろいろと違いがある。常用のツールはWSL2で、systemdやら何やらシステム管理のお試しはVMWareでやるのがいいかな。 initはsystemdではなく、MSが作ったinitが使われる。s…

You cannot set CPU affinity of PostgreSQL instance started through pg_ctl with Start-Process and Process.ProcessorAffinity

Background: In Windows, you can set the CPU affinity of an user process with Start-Process PowerShell cmdlet and System.Diagnostics.Process.ProcessorAffinity property like this: $app = Start-Process -FilePath C:\Windows\System32\mspaint.ex…

robocopy finished with no error, with erroneous result on OneDrive for Business

Background: You are using OneDrive for Bueiness. You are trying to copy files to OneDrive with robocopy. Problem: robocopy had finished with no error (with ERRORLEVEL 0), but the the size of the files on OneDrive is 0byte. Cause: It seems …

Laggy network connection between host and guest with Hyper-V on Windows 10

Problem When using Hyper-v on Windows 10, network connection between host and guest stops intermittingly. You can ping from host to guest. Ping causes "Request timed out" intermittingly. Ping losses around 10% of packets. Symptom doesn't c…

FNTCACHE.DATを削除できない場合の対処法

フォントがおかしくなったら、セーフモードで起動してC:\Windows\System32\FNTCACHE.DATを削除しろとMSのKBにもあるが、残念ながらシンクライアントであるわが社の端末でセーフモードに入るには大阪のデータセンターまで行かなくてはならないのだ! 通常起動…

Kdiff3 (Windows) で日本語表示

Windows版の Kdiff3 には、日本語の表示がうまくできないバグがある模様。おそらく、2バイト文字の文字幅を1バイト文字と同じに解釈してしまっているのではないか。 「文字単位での比較」ができる珍しい diff なんだけどなぁ……

Windows の echo には -n オプションがない

Linux やら FreeBSD やらに付属の echo コマンドでは、 -n オプションを指定すると末尾に出力される改行が抑制される。 つまり $ echo -n abc > hoge.txt $ echo def >> hoge.txt $ cat hoge.txtとやると "abcdef" と出力される。 一方、Windows のコマンド…

オフラインファイル機能をキャッシュとして使う

Windows XP には「オフラインファイル」という機能がある。リモートのドライブをマウントしているときに、リモートとの接続が切断されても、オフラインファイルに指定したディレクトリの内容だけはアクセスできる(つまり、ローカルにファイルのコピーが取ら…