powershell - cmdlet as input to another -
i have following powershell command replacing in file:
(get-content c:\myfile.txt) | foreach-object { $_ -replace "date x", "date 2015.02.29" } | set-content c:\myfile.txt
i want hardcoded date (2015.02.29) come cmdlet:
(get-date -format yyyy.mm.dd)
how inject this?
just replace hardcoded value command:
(get-content c:\myfile.txt) | foreach-object { $_ -replace "date x", "date $(get-date -format yyyy.mm.dd)" } | set-content c:\myfile.txt
Comments
Post a Comment