Tuesday, 6 April 2021

How to remove file space using PowerShell

 How to remove the file space using PowerShell


For staring space remove


$STARTDATA = GET-CONTENT C:\TEMP\DATA\DATA.TXT

$STARTDATA | FOREACH {$_.TRIMSTART()} | SET-CONTENT C:\TEMP\DATA\DATA.TXT 


For ending space remove


$ENDDATA = GET-CONTENT C:\TEMP\DATA\DATA.TXT

$ENDDATA | FOREACH {$_.TRIMEND()} | SET-CONTENT C:\TEMP\DATA\DATA.TXT

 

2 comments: