サンプルを作りました。
Powershell
1$Target = "C:\Doc"
2switch -regex ( Get-Content -LiteralPath $Target\Con123.txt ){ # Con.txt → Con123.txt ファイル名を変更しました ※Conは使えません(予約語)
3 'alpha' {if ((Test-Path -LiteralPath $Target\alpha) -eq $True){& $Target\aaa.ps1}} # .ps → .ps1 拡張子を変更しました
4 'beta' {if ((Test-Path -LiteralPath $Target\beta ) -eq $True){& $Target\bbb.ps1}} # .ps → .ps1 拡張子を変更しました
5 'gamma' {if ((Test-Path -LiteralPath $Target\gamma) -eq $True){& $Target\ggg.ps1}} # .ps → .ps1 拡張子を変更しました
6 'omega' {if ((Test-Path -LiteralPath $Target\omega) -eq $True){& $Target\ooo.ps1}} # .ps → .ps1 拡張子を変更しました
7}
8
9# gammma → gamma 文字を変更しました ※Con123.txtの中身
10
11
12
13
①拡張子ps1ファイルを作成します。
②ps1ファイルをコンテキストメニューから「PowerShell で実行」を選択します。
お手数ですが修正箇所をご確認ください。