Weird behaviour in PowerShell bulk file renaming
I'm new to PowerShell and recently I try to rename 120 files in a folder and I encounter a weird behavior. What I have is files with named from 0001.txt, 0002.txt, ... 0120.txt a total of 120 files. I want to add an 'a' in front of each of the file name. I came up with this command: ls | ren -newname {$_.name -replace '(\d+)','a$1'} But after execution, I get numerous error like this: "The specified path, file name, or both are too long. The fully qualified file name must be less than 260" And when I look into my folder, all I get are file names from aaaaaaaaaaaaaaaaaaaaaaaaa(repeat until it