-2

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ash_05
  • 1
  • 1

0 Answers0