Come posso ottenere il mio script PowerShell per stampare le informazioni in formato tabulare man mano che lo script avanza.Come creare l'effetto printf in PowerShell
In bash vorrei fare questo
printf "%s\t%-15.15s" "Locale" "Jar"
if($verbose);then
printf "%-15.15s %-15.15s" "HelpSet" "Exception"
fi
printf "\t%s\n" "Status"
...
printf "%s\t%-15.15s" $locale $helpFileName
if($verbose); then
printf "%-15.15s %-15.15s" "$helpSetName" ${exclusion[$helpFileName]}
fi
status="OK"
...
if ($fixed); then
status="CORRECTED"
fi
printf "\t%s\n" $status
per ottenere
Locale Jar HelpSet Exception Status
de help_D150 help_D150 CORRECTED
es help_D150 help_D150 OK
fr help_D150 help_D150 OK
it Locale folder not found
nl help_D150 help_D150 CORRECTED
Grazie
Con questo approccio due delle colonne condizionali vengono stampate su una nuova riga anziché sulla stessa riga – rojanu
Usa una stringa di singolo formato, combinando tutte le colonne, e usa $ null o una stringa vuota per gli argomenti che non vuoi stampare. –