I'm using a simple script that outputs current directory's path inside a log file:
(Get-Item .).FullName | out-file "C:\windows\system32\rcwm\rc.log" -append
This works most of the time. However, seemingly at random, appending will result in added spaces after every character in the output string. My rc.log
file will then look like this:
C:\Users\root\Desktop\2222
C : \ U s e r s \ r o o t \ D e s k t o p \ 2 2 2 2
Notice how I outputted the same directory name twice, and the results inside the log file were different.
Once this happens, every subsequent string appended into the log file will have spaces in between characters.
What could be the issue?