Forum Discussion
How to save powershell script to a text file on desktop?
- Sep 17, 2026
I'd probably suggest formatting your code, but you have space after desktop in your path which is probably ur issue. I also would remove the space before test, but technically that would work. before test, that's probably the issue.
I'd probably suggest formatting your code, but you have space after desktop in your path which is probably ur issue. I also would remove the space before test, but technically that would work. before test, that's probably the issue.
- Alan1679Sep 18, 2026Copper Contributor
Thanks Nrvonogd
I am surprised the two spaces caused the problem. I thought PowerShell ignore empty space!!
I am glad it works because I am running out of ideas.
Thanks
- nrvonogdSep 21, 2026Brass Contributor
Well - there's a difference in empty space in code and empty space in a path. Spaces are supported in windows paths, so PowerShell has no idea if it should trim that space or leave it. Since spaces are supported in paths, it's not going to ignore it. I hope that helps better explain why.