Here is the command I am executing:
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\*" | Where-Object {$_."(default)" -ne $null} | Select-Object @{ expression={$_.PSChildName}; label='Program'} ,@{ expression={$q + $_."(default)" +$q}; label='CommandLine'}
Here is a snippet of the output:
Program CommandLine
------- -----------
7zFM.exe C:\Program Files\7-Zip\7zFM.exe
AcroRd32.exe C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe
Adobe Audition CC.exe "C:\Program Files\Adobe\Adobe Audition CC 2019\Adobe Audition CC.exe"
Adobe Media Encoder.exe "C:\Program Files\Adobe\Adobe Media Encoder CC 2019\Adobe Media Encoder.exe"
Adobe Premiere Pro.exe "C:\Program Files\Adobe\Adobe Premiere Pro CC 2019\Adobe Premiere Pro.exe"
AfterFX.exe C:\Program Files\Adobe\Adobe After Effects CC 2019\Support Files\AfterFX.exe
BJMYDGN.EXE C:\Program Files\Canon\MyPrinter\BJMyDgn.exe
BJMYPRT.EXE C:\Program Files\Canon\MyPrinter\BJMyPrt.exe
I'm new to text formatting, and I am trying to create this in a csv file, with 2 columns, Programs and Executables and removing all Quotation Marks "". The $q + removes quotation marks, however if an item has 2 sets of quotation marks, one set remains as above (sorry I should have clarified that..
I think I am running in circles and just looking for some help.
I figured out the csv formatting by piping this:
| Export-Csv -Path .\programs.csv -Encoding ascii -NoTypeInformation
Like this?
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\*" | Where "(default)" -ne $null |
Select @{ E={$_.PSChildName}; N='Program'} ,@{ E={$_."(default)".Trim('"')}; N='CommandLine'} |
export-csv .\programs.csv -Encoding ascii -NoType
Thank you Esperento57 and Ryan, this bottom code worked.