![]() ![]() The location of it on my machine is C:\WINDOWS\system32\WindowsPowerShell\v1.0 Powershell.exe should be part of your PATH statement already, but if not you can add it. -encoding ASCII prevents transcribing the output file to unicode, as the comments point out.| Out-File myFile.txt pipes the output to the file myFile.txt.-replace 'foo', 'bar' simply runs the replace command to replace foo with bar.(gc myFile.txt) reads the content of myFile.txt ( gc is short for the Get-Content command)." is a command line arg for powershell.exe containing the command to run powershell starts up powershell.exe, which is included in Windows 7.Here is the script I used to find/replace all instances of text in a file: powershell -Command "(gc myFile.txt) -replace 'foo', 'bar' | Out-File -encoding ASCII myFile.txt" I have Windows 7, which comes with PowerShell built-in. A lot of the answers here helped point me in the right direction, however none were suitable for me, so I am posting my solution. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |