I wanted to rename subtitle files so that they match names of video files.

Dir *.ass | ForEach-Object -begin { $count=1; $countD="{0:D2}" -f $count } -process { rename-item -LiteralPath $_ -NewName "`[Aurora-Raws`] Death Note $countD (BD 1920x1080 HEVC-YUV420P10 FLAC).ass"; $count++; $countD="{0:D2}" -f $count }

e.g. make

[Aurora-Raws] Death Note 01 (BD 1920x1080 HEVC-YUV420P10 FLAC).mkv

associate with

[Aurora-Raws] Death Note 01 (BD 1920x1080 HEVC-YUV420P10 FLAC).ass

But the Powershell would not accept [ and ], the double quotes. So I used ` as escape characters. -LiteralPath makes powershell accept legacy file names/paths, which prevent square brackets issues. "{0:D2}" -f $count is to format numbers, so that 1 will be displayed as 01. Details at Microsoft’s website. New variable $countD is created because $countD is no longer a number, which can be operated by ++.