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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -