Shell.Application での PowerShell 文字列補間

Shell.Application での PowerShell 文字列補間

PowerShell スクリプトがあります。

$filex = Get-ChildItem C:\somewhere\anotherfolder\anotherfolder\lastfolder\ -recurse -Filter *coolfile.exe
$ShellExp = New-Object -ComObject Shell.Application
$ShellExp.open("{$filex} http://speedtest.tele2.net/10MB.zip %appdata%\101x.zip")

$filex を実行するにはどうすればいいですか?

答え1

あなたはこれと同じ質問をしていると思います:https://stackoverflow.com/q/44035920/7537973 その場合の答えはここにあります:https://stackoverflow.com/a/44036090/7537973

要約すると、関数を$()内に置くと、あなたの例では次のようになります。$ShellExp.open("$(Get-ChildItem C:\somewhere\anotherfolder\anotherfolder\lastfolder\ -recurse -Filter *coolfile.exe) http://speedtest.tele2.net/10MB.zip %appdata%\101x.zip")

関連情報