[リストへもどる]
一括表示

タイトル現在窓ディレクトリで分岐
記事No5293
投稿日: 2026/07/05(Sun) 22:28
投稿者ぞえま
質問おねがいします。
現在窓ディレクトリ名で完全一致させて分岐して、実行するコマンドを変えたいです。
PPx Helpの*ifmatchの項を参考に書いてみました。
【例4】や【例5】が正解だと思うのですが、うまくいきません。
どう書くのが正しいのでしょうか?
(ppx64208, Win11 Home 26200.8737)

以下は成功しました(ただ中間一致はできればやりたくなく)。

【例1】
*ifmatch "*dir1*","%1" %: *msgbox "dir1 is ok" %: *stop
*ifmatch "*dir2*","%1" %: *msgbox "dir2 is ok" %: *stop
*msgbox "not match"

以下はいずれも失敗しました。

【例2】
*ifmatch "*dir1","%1" %: *msgbox "dir1 is ok" %: *stop
*ifmatch "*dir2","%1" %: *msgbox "dir2 is ok" %: *stop
*msgbox "not match"

【例3】
*ifmatch "*dir1\","%1" %: *msgbox "dir1 is ok" %: *stop
*ifmatch "*dir2\","%1" %: *msgbox "dir2 is ok" %: *stop
*msgbox "not match"

【例4】
*ifmatch "*\dir1","%1" %: *msgbox "dir1 is ok" %: *stop
*ifmatch "*\dir2","%1" %: *msgbox "dir2 is ok" %: *stop
*msgbox "not match"

【例5】
*ifmatch "*\parent\dir1","%1" %: *msgbox "dir1 is ok" %: *stop
*ifmatch "*\parent\dir2","%1" %: *msgbox "dir2 is ok" %: *stop
*msgbox "not match"


"o:s,*\dir1"などとしてもダメでした。"p:dir1"とすると「指定されたファイルが見つかりません。(2)」とエラーになりました。


タイトルRe: 現在窓ディレクトリで分岐
記事No5295
投稿日: 2026/07/05(Sun) 23:14
投稿者TORO
*ifmatch "o:d,dir1","%1" %: *msgbox "dir1 is ok"
で意図した動作になります。

上記だと、%1 の最後のエントリ(o:d でディレクトリも許容)に対して、
dir1 が完全一致するか否かになります。

p:dir1 については後で調べてみます。