0
파일의 문자열을 찾아서 바꾸고 PowerShell의 원본 파일에 저장하려고합니다.PowerShell -replace function
나는
(Get-Content "C:\Users\anon\Desktop\test.txt")
-replace 'apple', 'apple1'
-replace 'bear' , 'bear1' |
Out-File test1.txt
pause
그러나, 나는 "abcd".replace()
벌금과 문서 -replace
에 따른 너무 작업을해야 사용할 수있었습니다
-replace : The term '-replace' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\Xing Chen\Desktop\test.ps1:2 char:1 + -replace 'apple', 'apple1' + ~~~~~~~~ + CategoryInfo : ObjectNotFound: (-replace:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
점점 계속 일을 시도했습니다.
당신은 라인이 PowerShell을'(은 Get-내용 "C 해석합니다 휴식 탈출하지 않고 새로운 라인에'-replace' 연산자를 넣으면 : \ 사용자 \ 곧 \ 바탕 화면 \를 '-replace' 연산을'Get-Text '와 같은 행에 넣고'-replace '연산을' –
@AnsgarWiechers - 대답으로 제안하면 querent의 문제를 해결할 것입니다. –
@JeffZeitlin 저는 이것을 "간단한 타이포그래피 오류"의 경우로 생각하고 clo에 투표했습니다. se. –