I am in directory G:\TXT and I want to change the 2 file names (a01mm.txt and a02mm.txt into a01.txt and a02.txt) in folder TXT, but it doesn't work. There was no result whatsoever. Can anybody please tell me what I did wrong. I tried
gci | rni -newname { $_.name -TrimEnd(2) }
PowerShell:
Or
After running this PowerShell script, the files "a01mm.txt" and "a02mm.txt" should be renamed to "a01.txt" and "a02.txt" in the "TXT" directory. Make sure you're in the correct directory when running the script, or provide the full path to the files if needed