replace characters with . bat

Asked

Viewed 701 times

1

I’m trying to replace several strings inside a file, until I can make another change one of them do not want to change or locate, follow me code and what appears in the CMD screen.

I’m trying to do this for a batch, what I want is to access the file web.config.template, in instruction

fart web.config.TEMPLATE  "Prefeitura Municipal de Uberlândia"  "Prefeitura Municipal de Araxa"

I want him to locate "Prefeitura Municipal de Uberlândia" inside the archive web config. and replaced by "Prefeitura Municipal de Araxa"

Example:

Content of txt file.

Meu nome é Marcos Henrique

after executing the script bat. the result should be:

Content of txt file.

Meu nome é Fabio Vermieiro

follow link less than I want to do :

https://www.devmedia.com.br/forum/substituir-caracteres-com-bat/590399

cls
echo off
cls
cd C:\inetpub\wwwroot\Saude\Governa.Saude.Gestao
fart web.config.TEMPLATE "Server=srvhades,1100;Database=DB_SAUDE_GESTAO;User Id=SA;Password=;"                    "Server=srvjavabd,1433;Database=DB_SAUDE_GESTAO;User Id=admfsc;Password=municipio;"
fart web.config.TEMPLATE "Server=srvhades,1100;Database=DB_SAUDE_PROCEDIMENTO;User Id=SA;Password=;"              "Server=srvjavabd,1433;Database=DB_SAUDE_PROCEDIMENTO;User Id=admfsc;Password=municipio;"
fart web.config.TEMPLATE  "http://localhost/leitorbiometria/publish.htm"                                     "http://localhost:90/leitorbiometria/publish.htm" 
fart web.config.TEMPLATE  "Prefeitura Municipal de Uberlândia"  "Prefeitura Municipal de Araxa"
fart web.config.TEMPLATE  "http://localhost/Governa.Saude.Almoxarifado/Servicos/MaterialService.svc"       "http://localhost:90/Governa.Saude.Almoxarifado/Servicos/MaterialService.svc"
fart web.config.TEMPLATE  "http://localhost/Governa.Saude.Ambulatorio/Servicos/AmbulatorioService.svc"     "http://localhost:90/Governa.Saude.Ambulatorio/Servicos/AmbulatorioService.svc"
echo 
echo Realizado a alteracao no arquivo por completo....

response on the CMD SCREEN (has one that doesn’t change 0 files)

Web.config.TEMPLATE
Replaced 1 occurence(s) in 1 file(s).
Web.config.TEMPLATE
Replaced 1 occurence(s) in 1 file(s).
Web.config.TEMPLATE
Replaced 1 occurence(s) in 1 file(s).
Replaced 0 occurence(s) in 0 file(s).
Web.config.TEMPLATE
Replaced 1 occurence(s) in 1 file(s).
Web.config.TEMPLATE
Replaced 1 occurence(s) in 1 file(s).
  • Your problem has occurred in the strings that use accents, try repeating your commands by replacing the accents occurrences with ?!

  • Example: fart web.config.TEMPLATE "Prefeitura Municipal de Uberl?ndia" "Prefeitura Municipal de Araxa"

  • I put ? but still does not change the String, has idea of what can be?

  • I will download and see alternative q meets, it should support the use of jokers: ? and * .. try as well: fart web.config.TEMPLATE "Prefeitura Municipal de Uberl*ndia" "Prefeitura Municipal de Araxa"`

  • I tried with * too, but he still doesn’t recognize

  • Try it like this, it worked here: chcp 850 2>nul >nul & fart.exe -i .web.config.TEMPLATE Uberlândia Araxa n need to use prefecture of such for prefecture of such ...

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.