Beginners question on Powershell (version 3 is in use). Those variables work fine, but they can be perhaps improved
I have, inside a loop
$LastWriteTime = get-childitem $file.fullname | select LastWriteTime
$LastWriteTime_text = "$LastWriteTime"
$LastWriteTime_text_short = $LastWriteTime_text.substring(16,10) -replace "\W", '_'
The 2nd and 3rd line are because I don't know how to reformat the output of the first line directly as text. Therefore " ... ". It works. But using those extra variables is not efficient
Another also not too nice formatting using extra variables (which is kinda bad). I just dont know how to pipe
$check_hex = get-content -Path "C:\Test Script\Table.txt" | select-string -pattern "$file_type" | select -first 1
$check_hex_trim = $check_hex -replace "\W", '_'
$check_hex_txt = $check_hex_trim -creplace '[^A-Z]',''
Is there also a source with practicale examples how to handle those formatings?