{"id":1355,"date":"2016-09-14T10:50:38","date_gmt":"2016-09-14T13:50:38","guid":{"rendered":"http:\/\/www.franklinjr.com\/blog\/?p=1355"},"modified":"2016-09-14T10:50:38","modified_gmt":"2016-09-14T13:50:38","slug":"substituir-string-em-arquivo-com-powershell","status":"publish","type":"post","link":"https:\/\/www.franklinjr.com\/blog\/index.php\/2016\/09\/14\/substituir-string-em-arquivo-com-powershell\/","title":{"rendered":"Substituir string em arquivo com PowerShell"},"content":{"rendered":"<p>Para dar replace em uma determinada string dentro de um arquivo no powershell, o comando \u00e9 o seguinte<\/p>\n<pre lang=\"powershell\">\r\nPS C:\\> (Get-Content %caminhoDoArquivo%).Replace('%stringDeEntrada%', '%stringDeSaida%') | Set-Content %caminhoDoArquivo%\r\n<\/pre>\n<p>O comando l\u00ea o conte\u00fado do arquivo para substituir o conte\u00fado de entrada pelo conte\u00fado de sa\u00edda, e ent\u00e3o grava o conte\u00fado novo no arquivo informado.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Para dar replace em uma determinada string dentro de um arquivo no powershell, o comando \u00e9 o seguinte PS C:\\> (Get-Content %caminhoDoArquivo%).Replace(&#8216;%stringDeEntrada%&#8217;, &#8216;%stringDeSaida%&#8217;) | Set-Content %caminhoDoArquivo% O comando l\u00ea o conte\u00fado do arquivo para substituir o conte\u00fado de entrada pelo conte\u00fado de sa\u00edda, e ent\u00e3o grava o conte\u00fado novo no arquivo informado.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[553],"tags":[577,588,600,599],"class_list":["post-1355","post","type-post","status-publish","format-standard","hentry","category-power-shell","tag-powershell","tag-replace","tag-string","tag-substituir"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>Substituir string em arquivo com PowerShell - Franklin Jr.<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.franklinjr.com\/blog\/index.php\/2016\/09\/14\/substituir-string-em-arquivo-com-powershell\/\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.franklinjr.com\\\/blog\\\/index.php\\\/2016\\\/09\\\/14\\\/substituir-string-em-arquivo-com-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\\\/\\\/www.franklinjr.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Substituir string em arquivo com PowerShell\"}]}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Substituir string em arquivo com PowerShell - Franklin Jr.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.franklinjr.com\/blog\/index.php\/2016\/09\/14\/substituir-string-em-arquivo-com-powershell\/","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/www.franklinjr.com\/blog\/index.php\/2016\/09\/14\/substituir-string-em-arquivo-com-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/www.franklinjr.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Substituir string em arquivo com PowerShell"}]}]}},"_links":{"self":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1355"}],"version-history":[{"count":1,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1355\/revisions"}],"predecessor-version":[{"id":1356,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1355\/revisions\/1356"}],"wp:attachment":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}