I cant format the output of this command correctly

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


Read more here: https://stackoverflow.com/questions/65056779/i-cant-format-the-output-of-this-command-correctly

Content Attribution

This content was originally published by blaine vautour at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: