Is it possible to batch replace a text string inside a cmd file in every subfolder?
The folder structure is:
Root Folder (Batch script) > Several subfolders > job(folder number)_EncodeAudio.cmd
> text string
The cmd file has the 128
string that should be replaced to 384
and each subfolder (job1, job2, job3) has the same job(folder number)_EncodeAudio.cmd
file.
This is better explained in a single image:
Used Billy's script and a BAT to call the Powershell script.
BAT file:
CD /D %root% C:\Root Folder Location
powershell.exe -ExecutionPolicy ByPass -file batch.ps1
PS1 file:
Get-ChildItem *.cmd -Recurse | ForEach-Object { (Get-Content $_) | ForEach-Object { $_ -replace '128','384' } | Set-Content $_ }