Powershell-String-Interpolation in Shell.Application

Powershell-String-Interpolation in Shell.Application

Ich habe ein PowerShell-Skript;

$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")

Was muss ich tun, um $filex auszuführen?

Antwort1

Ich glaube, Sie stellen dieselbe Frage wie diese:https://stackoverflow.com/q/44035920/7537973 In diesem Fall lautet die Antwort hier:https://stackoverflow.com/a/44036090/7537973

Tl;dr Setzen Sie die Funktion in $(), so dass sie in Ihrem Beispiel lautet$ShellExp.open("$(Get-ChildItem C:\somewhere\anotherfolder\anotherfolder\lastfolder\ -recurse -Filter *coolfile.exe) http://speedtest.tele2.net/10MB.zip %appdata%\101x.zip")

verwandte Informationen