2016-05-10 28 views
1

私はこのPowerShellコマンドを実行しようとしている:このpowershellコマンドをバッチファイルで実行する方法は?

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > C:\Users\Administrateur\Desktop\Mysoftware.txt 

をバッチファイルで。これは私が今得たものである:

powershell.exe -noexit -command "& {Get-ItemProperty 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'; Select-Object DisplayName, DisplayVersion, Publisher, InstallDate; Format-Table -Autosize; > 'C:\Users\Administrateur\Desktop\Mysoftware.txt';}" 

が、それは私に言っています「>」私がやろうとしている

どのコマンドではありませんMySoftwareに、コンピュータのすべてのソフトウェアのリストを取得されます.txtファイル。

助けてくれてありがとう

+0

backtick?書き込み出力? btw、なぜバッチですが、豪華なスクリプトではありませんか? –

+1

を追加しました。その前に>あなたが示す荘厳なコマンドにはありません。 – EBGreen

+0

また、インストールされている32ビットのアプリのみが表示されます。 – EBGreen

答えて

1

";" ">"でファイルにリダイレクトして "|"を使用する前に、 ";"の代わりに次のコマンドの入力にコマンドの出力を渡す。各コマンドの終わりに。

powershell.exe -noexit -command "& {Get-ItemProperty 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -Autosize > 'C:\Users\Administrateur\Desktop\Mysoftware.txt' }" 
+0

ありがとう、それは今働いている。 –

0

あなたはこの行を代わりに試すことができますか?

powershell.exe -noexit -command "& {Get-ItemProperty 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | export-csv 'C:\Users\Administrateur\Desktop\Mysoftware.csv' -nti}" 
関連する問題