I am trying to replace the contents of the configuration file from Test_0809.zip
with Test_todaysdate.zip
.
$file=‘D:\Datafiles\test\Console.config’
$date=get-date -format MMdd
((Get-content -path $file) -replace ‘Test_\d\d\d\d.zip’, ‘Test_$date.zip’) | set-content -path $file
The expected output is Test_0819
.
But it didn’t work.