I am trying to put 2 powershell commands into a .bat file so I can just click on the file and run them, without opening powershell, pasting in the commands, etc.
The commands are:
cd Downloads
get-childitem *.mp4 | foreach { rename-item $_ $_.Name.Replace("yt5s.com-", "") }
I currently have a .bat file with powershell -ExecutionPolicy Bypass -Command 'cd Downloads; get-childitem *.mp4 | foreach { rename-item $_ $_.Name.Replace("yt5s.com-", "") }'
, but it isn’t working. I also tried:
powershell -Command 'cd Downloads; get-childitem *.mp4 | foreach { rename-item $_ $_.Name.Replace("yt5s.com-", "") }'
powershell -command 'cd Downloads; get-childitem *.mp4 | foreach { rename-item $_ $_.Name.Replace("yt5s.com-", "") }'
powershell -Command "cd Downloads; get-childitem *.mp4 | foreach { rename-item $_ $_.Name.Replace("yt5s.com-", "") }"
powershell -command "cd Downloads; get-childitem *.mp4 | foreach { rename-item $_ $_.Name.Replace("yt5s.com-", "") }"
powershell -ExecutionPolicy Bypass -Command "cd Downloads; get-childitem *.mp4 | foreach { rename-item $_ $_.Name.Replace("yt5s.com-", "") }"
How can I have a powershell command in a .bat file or something similliar?