0
ファイル内の文字列を見つけて置き換え、PowerShellの元のファイルに保存しようとしています。PowerShell-replace関数
私は(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は '(ゲット・コンテンツ「C解釈します破るエスケープせずに新しい行に' -replace'オペレータを置く場合:\ Users \ユーザーアノン\デスクトップ\を"replace"と同じ行に '-replace'オペレーションを置いてください。' -replace'オペレーションを 'Get- –
@AnsgarWiechers - 答えとして提案すると、クエレンの問題を解決します –
@JeffZeitlin私はこれを "シンプルなタイポグラフィエラー"のケースと考え、クローに投票しましたse。 –