Find and replace text via batch file
I have seen this question asked but never with a suitable answer for what I need
I work doing remote tech support on computer systems and one of the things I frequently need to do is open ini files and replace certain lines with a new one
as an example we will say.
program.ini
program status = client
Well I would need to change that to server so it reads
program status = server
While yes I can open it in notepad I want to be able to do this via command line in a batch file as I already have a batch tool I have created for everything else I do.
Now, note that not every computer supports powershell scripts so this has to be just in the one batch file. I can not download any additional software as these are not my systems I am connecting to.
Anyone know how this would be done purely via batch as I am at a loss.
Not looking to open an editor via command line, just a straight up run it and that line is changed in the ini file.
Thanks for any input
-Terra
windows batch editing
|
show 1 more comment
I have seen this question asked but never with a suitable answer for what I need
I work doing remote tech support on computer systems and one of the things I frequently need to do is open ini files and replace certain lines with a new one
as an example we will say.
program.ini
program status = client
Well I would need to change that to server so it reads
program status = server
While yes I can open it in notepad I want to be able to do this via command line in a batch file as I already have a batch tool I have created for everything else I do.
Now, note that not every computer supports powershell scripts so this has to be just in the one batch file. I can not download any additional software as these are not my systems I am connecting to.
Anyone know how this would be done purely via batch as I am at a loss.
Not looking to open an editor via command line, just a straight up run it and that line is changed in the ini file.
Thanks for any input
-Terra
windows batch editing
Do the edited lines need to stay in order? Can we assume VBScript and cscript?
– harrymc
Dec 21 '18 at 16:49
Yes, it is an ini with about 100+ Lines and has to stay in order. And as stated, it can not include any extra files, installations, or downloads. Looking for a way in pure command line commands in a batch script. I am much more used to linux bash and still learning this stuff for windows. So correct me if I am wrong, but wouldn't a VBScript or cScript require additional files?
– Terra Envy
Dec 21 '18 at 17:02
1) When you add more information to answer a Comment, please click edit and add it to your original question, so the question contains all the information needed to explain the issue. Then, delete the Comment by clicking on the grey (S) at its end, for Comments can pile up and when they do, some Comments get hidden.
– K7AAY
Dec 21 '18 at 19:42
There is no native search text and replace commend in Windows. 2) For PCs w/ PowerShell, you can script w/ a command like cat program.ini | %{$<underscore> -replace "program status = client","program status = server"} (replacing <underscore> w/ a real underscore character.
– K7AAY
Dec 21 '18 at 19:50
3) For PCs w/ no PowerShell, suggest adding Open Source sed & its dependencies gnuwin32.sourceforge.net/packages/sed.htm to a temp directory (thereby avoiding any installation or change to the Registry), run a sed script in that directory for the task(s), then purge it & its dependencies as the last thing you do. 4) An alternative is Open Source FreeDOS edlin en.wikipedia.org/wiki/Edlin#Scripts It runs in Windows 10 x64 & x32 and earlier Windows versions. It allows simple search text and replace scripting. sourceforge.net/projects/freedos-edlin/files/latest/download
– K7AAY
Dec 21 '18 at 19:57
|
show 1 more comment
I have seen this question asked but never with a suitable answer for what I need
I work doing remote tech support on computer systems and one of the things I frequently need to do is open ini files and replace certain lines with a new one
as an example we will say.
program.ini
program status = client
Well I would need to change that to server so it reads
program status = server
While yes I can open it in notepad I want to be able to do this via command line in a batch file as I already have a batch tool I have created for everything else I do.
Now, note that not every computer supports powershell scripts so this has to be just in the one batch file. I can not download any additional software as these are not my systems I am connecting to.
Anyone know how this would be done purely via batch as I am at a loss.
Not looking to open an editor via command line, just a straight up run it and that line is changed in the ini file.
Thanks for any input
-Terra
windows batch editing
I have seen this question asked but never with a suitable answer for what I need
I work doing remote tech support on computer systems and one of the things I frequently need to do is open ini files and replace certain lines with a new one
as an example we will say.
program.ini
program status = client
Well I would need to change that to server so it reads
program status = server
While yes I can open it in notepad I want to be able to do this via command line in a batch file as I already have a batch tool I have created for everything else I do.
Now, note that not every computer supports powershell scripts so this has to be just in the one batch file. I can not download any additional software as these are not my systems I am connecting to.
Anyone know how this would be done purely via batch as I am at a loss.
Not looking to open an editor via command line, just a straight up run it and that line is changed in the ini file.
Thanks for any input
-Terra
windows batch editing
windows batch editing
asked Dec 21 '18 at 16:14
Terra Envy
6
6
Do the edited lines need to stay in order? Can we assume VBScript and cscript?
– harrymc
Dec 21 '18 at 16:49
Yes, it is an ini with about 100+ Lines and has to stay in order. And as stated, it can not include any extra files, installations, or downloads. Looking for a way in pure command line commands in a batch script. I am much more used to linux bash and still learning this stuff for windows. So correct me if I am wrong, but wouldn't a VBScript or cScript require additional files?
– Terra Envy
Dec 21 '18 at 17:02
1) When you add more information to answer a Comment, please click edit and add it to your original question, so the question contains all the information needed to explain the issue. Then, delete the Comment by clicking on the grey (S) at its end, for Comments can pile up and when they do, some Comments get hidden.
– K7AAY
Dec 21 '18 at 19:42
There is no native search text and replace commend in Windows. 2) For PCs w/ PowerShell, you can script w/ a command like cat program.ini | %{$<underscore> -replace "program status = client","program status = server"} (replacing <underscore> w/ a real underscore character.
– K7AAY
Dec 21 '18 at 19:50
3) For PCs w/ no PowerShell, suggest adding Open Source sed & its dependencies gnuwin32.sourceforge.net/packages/sed.htm to a temp directory (thereby avoiding any installation or change to the Registry), run a sed script in that directory for the task(s), then purge it & its dependencies as the last thing you do. 4) An alternative is Open Source FreeDOS edlin en.wikipedia.org/wiki/Edlin#Scripts It runs in Windows 10 x64 & x32 and earlier Windows versions. It allows simple search text and replace scripting. sourceforge.net/projects/freedos-edlin/files/latest/download
– K7AAY
Dec 21 '18 at 19:57
|
show 1 more comment
Do the edited lines need to stay in order? Can we assume VBScript and cscript?
– harrymc
Dec 21 '18 at 16:49
Yes, it is an ini with about 100+ Lines and has to stay in order. And as stated, it can not include any extra files, installations, or downloads. Looking for a way in pure command line commands in a batch script. I am much more used to linux bash and still learning this stuff for windows. So correct me if I am wrong, but wouldn't a VBScript or cScript require additional files?
– Terra Envy
Dec 21 '18 at 17:02
1) When you add more information to answer a Comment, please click edit and add it to your original question, so the question contains all the information needed to explain the issue. Then, delete the Comment by clicking on the grey (S) at its end, for Comments can pile up and when they do, some Comments get hidden.
– K7AAY
Dec 21 '18 at 19:42
There is no native search text and replace commend in Windows. 2) For PCs w/ PowerShell, you can script w/ a command like cat program.ini | %{$<underscore> -replace "program status = client","program status = server"} (replacing <underscore> w/ a real underscore character.
– K7AAY
Dec 21 '18 at 19:50
3) For PCs w/ no PowerShell, suggest adding Open Source sed & its dependencies gnuwin32.sourceforge.net/packages/sed.htm to a temp directory (thereby avoiding any installation or change to the Registry), run a sed script in that directory for the task(s), then purge it & its dependencies as the last thing you do. 4) An alternative is Open Source FreeDOS edlin en.wikipedia.org/wiki/Edlin#Scripts It runs in Windows 10 x64 & x32 and earlier Windows versions. It allows simple search text and replace scripting. sourceforge.net/projects/freedos-edlin/files/latest/download
– K7AAY
Dec 21 '18 at 19:57
Do the edited lines need to stay in order? Can we assume VBScript and cscript?
– harrymc
Dec 21 '18 at 16:49
Do the edited lines need to stay in order? Can we assume VBScript and cscript?
– harrymc
Dec 21 '18 at 16:49
Yes, it is an ini with about 100+ Lines and has to stay in order. And as stated, it can not include any extra files, installations, or downloads. Looking for a way in pure command line commands in a batch script. I am much more used to linux bash and still learning this stuff for windows. So correct me if I am wrong, but wouldn't a VBScript or cScript require additional files?
– Terra Envy
Dec 21 '18 at 17:02
Yes, it is an ini with about 100+ Lines and has to stay in order. And as stated, it can not include any extra files, installations, or downloads. Looking for a way in pure command line commands in a batch script. I am much more used to linux bash and still learning this stuff for windows. So correct me if I am wrong, but wouldn't a VBScript or cScript require additional files?
– Terra Envy
Dec 21 '18 at 17:02
1) When you add more information to answer a Comment, please click edit and add it to your original question, so the question contains all the information needed to explain the issue. Then, delete the Comment by clicking on the grey (S) at its end, for Comments can pile up and when they do, some Comments get hidden.
– K7AAY
Dec 21 '18 at 19:42
1) When you add more information to answer a Comment, please click edit and add it to your original question, so the question contains all the information needed to explain the issue. Then, delete the Comment by clicking on the grey (S) at its end, for Comments can pile up and when they do, some Comments get hidden.
– K7AAY
Dec 21 '18 at 19:42
There is no native search text and replace commend in Windows. 2) For PCs w/ PowerShell, you can script w/ a command like cat program.ini | %{$<underscore> -replace "program status = client","program status = server"} (replacing <underscore> w/ a real underscore character.
– K7AAY
Dec 21 '18 at 19:50
There is no native search text and replace commend in Windows. 2) For PCs w/ PowerShell, you can script w/ a command like cat program.ini | %{$<underscore> -replace "program status = client","program status = server"} (replacing <underscore> w/ a real underscore character.
– K7AAY
Dec 21 '18 at 19:50
3) For PCs w/ no PowerShell, suggest adding Open Source sed & its dependencies gnuwin32.sourceforge.net/packages/sed.htm to a temp directory (thereby avoiding any installation or change to the Registry), run a sed script in that directory for the task(s), then purge it & its dependencies as the last thing you do. 4) An alternative is Open Source FreeDOS edlin en.wikipedia.org/wiki/Edlin#Scripts It runs in Windows 10 x64 & x32 and earlier Windows versions. It allows simple search text and replace scripting. sourceforge.net/projects/freedos-edlin/files/latest/download
– K7AAY
Dec 21 '18 at 19:57
3) For PCs w/ no PowerShell, suggest adding Open Source sed & its dependencies gnuwin32.sourceforge.net/packages/sed.htm to a temp directory (thereby avoiding any installation or change to the Registry), run a sed script in that directory for the task(s), then purge it & its dependencies as the last thing you do. 4) An alternative is Open Source FreeDOS edlin en.wikipedia.org/wiki/Edlin#Scripts It runs in Windows 10 x64 & x32 and earlier Windows versions. It allows simple search text and replace scripting. sourceforge.net/projects/freedos-edlin/files/latest/download
– K7AAY
Dec 21 '18 at 19:57
|
show 1 more comment
1 Answer
1
active
oldest
votes
This batch file includes some diagnostic information, too. The setlocal line is REQUIRED in order to properly play with variables in a loop.
The most significant side-effects of using this method are that blank lines are removed (they're ignored by FOR) and that your tests (in the "write out the new value" section) are very specific: spaces and case matter. You can perform case insensitive matching with /i, but since you're including the spaces in your question I suspect you prefer to include them. You'll need to include multiple lines as done in that section to replicate each possible comparison.
@ECHO OFF
setlocal enableDelayedExpansion
FOR /F "tokens=1,* delims==" %%i IN (test.ini) DO (
SET sdone=0
SET "sname=%%i"
SET "svalue=%%j"
ECHO.Name: !sname!
ECHO.Value: !svalue!
:: write out headers
IF "!sdone!"=="0" IF "!sname:~0,1!"=="[" SET sdone=1&&ECHO.Type: Header&&ECHO.!sname!>>new.ini
:: write out the new value if it's client
IF "!sdone!"=="0" IF "!sname!"=="program status" IF "!svalue!"=="client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
IF "!sdone!"=="0" IF "!sname!"=="program status " IF "!svalue!"==" client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
:: write out anything else
IF "!sdone!"=="0" SET sdone=1&&ECHO.Type: Content&&ECHO.!sname!=!svalue!>>new.ini
:: a little padding to read the debug info
ECHO.
)
At the end you'll want to add something to overwrite the original file, something like:
copy /y new.ini test.ini
There are no spaces in the INI so this actually works perfectly as I needed. Very Much appreciate your response.
– Terra Envy
Dec 26 '18 at 16:53
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1386709%2ffind-and-replace-text-via-batch-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This batch file includes some diagnostic information, too. The setlocal line is REQUIRED in order to properly play with variables in a loop.
The most significant side-effects of using this method are that blank lines are removed (they're ignored by FOR) and that your tests (in the "write out the new value" section) are very specific: spaces and case matter. You can perform case insensitive matching with /i, but since you're including the spaces in your question I suspect you prefer to include them. You'll need to include multiple lines as done in that section to replicate each possible comparison.
@ECHO OFF
setlocal enableDelayedExpansion
FOR /F "tokens=1,* delims==" %%i IN (test.ini) DO (
SET sdone=0
SET "sname=%%i"
SET "svalue=%%j"
ECHO.Name: !sname!
ECHO.Value: !svalue!
:: write out headers
IF "!sdone!"=="0" IF "!sname:~0,1!"=="[" SET sdone=1&&ECHO.Type: Header&&ECHO.!sname!>>new.ini
:: write out the new value if it's client
IF "!sdone!"=="0" IF "!sname!"=="program status" IF "!svalue!"=="client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
IF "!sdone!"=="0" IF "!sname!"=="program status " IF "!svalue!"==" client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
:: write out anything else
IF "!sdone!"=="0" SET sdone=1&&ECHO.Type: Content&&ECHO.!sname!=!svalue!>>new.ini
:: a little padding to read the debug info
ECHO.
)
At the end you'll want to add something to overwrite the original file, something like:
copy /y new.ini test.ini
There are no spaces in the INI so this actually works perfectly as I needed. Very Much appreciate your response.
– Terra Envy
Dec 26 '18 at 16:53
add a comment |
This batch file includes some diagnostic information, too. The setlocal line is REQUIRED in order to properly play with variables in a loop.
The most significant side-effects of using this method are that blank lines are removed (they're ignored by FOR) and that your tests (in the "write out the new value" section) are very specific: spaces and case matter. You can perform case insensitive matching with /i, but since you're including the spaces in your question I suspect you prefer to include them. You'll need to include multiple lines as done in that section to replicate each possible comparison.
@ECHO OFF
setlocal enableDelayedExpansion
FOR /F "tokens=1,* delims==" %%i IN (test.ini) DO (
SET sdone=0
SET "sname=%%i"
SET "svalue=%%j"
ECHO.Name: !sname!
ECHO.Value: !svalue!
:: write out headers
IF "!sdone!"=="0" IF "!sname:~0,1!"=="[" SET sdone=1&&ECHO.Type: Header&&ECHO.!sname!>>new.ini
:: write out the new value if it's client
IF "!sdone!"=="0" IF "!sname!"=="program status" IF "!svalue!"=="client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
IF "!sdone!"=="0" IF "!sname!"=="program status " IF "!svalue!"==" client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
:: write out anything else
IF "!sdone!"=="0" SET sdone=1&&ECHO.Type: Content&&ECHO.!sname!=!svalue!>>new.ini
:: a little padding to read the debug info
ECHO.
)
At the end you'll want to add something to overwrite the original file, something like:
copy /y new.ini test.ini
There are no spaces in the INI so this actually works perfectly as I needed. Very Much appreciate your response.
– Terra Envy
Dec 26 '18 at 16:53
add a comment |
This batch file includes some diagnostic information, too. The setlocal line is REQUIRED in order to properly play with variables in a loop.
The most significant side-effects of using this method are that blank lines are removed (they're ignored by FOR) and that your tests (in the "write out the new value" section) are very specific: spaces and case matter. You can perform case insensitive matching with /i, but since you're including the spaces in your question I suspect you prefer to include them. You'll need to include multiple lines as done in that section to replicate each possible comparison.
@ECHO OFF
setlocal enableDelayedExpansion
FOR /F "tokens=1,* delims==" %%i IN (test.ini) DO (
SET sdone=0
SET "sname=%%i"
SET "svalue=%%j"
ECHO.Name: !sname!
ECHO.Value: !svalue!
:: write out headers
IF "!sdone!"=="0" IF "!sname:~0,1!"=="[" SET sdone=1&&ECHO.Type: Header&&ECHO.!sname!>>new.ini
:: write out the new value if it's client
IF "!sdone!"=="0" IF "!sname!"=="program status" IF "!svalue!"=="client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
IF "!sdone!"=="0" IF "!sname!"=="program status " IF "!svalue!"==" client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
:: write out anything else
IF "!sdone!"=="0" SET sdone=1&&ECHO.Type: Content&&ECHO.!sname!=!svalue!>>new.ini
:: a little padding to read the debug info
ECHO.
)
At the end you'll want to add something to overwrite the original file, something like:
copy /y new.ini test.ini
This batch file includes some diagnostic information, too. The setlocal line is REQUIRED in order to properly play with variables in a loop.
The most significant side-effects of using this method are that blank lines are removed (they're ignored by FOR) and that your tests (in the "write out the new value" section) are very specific: spaces and case matter. You can perform case insensitive matching with /i, but since you're including the spaces in your question I suspect you prefer to include them. You'll need to include multiple lines as done in that section to replicate each possible comparison.
@ECHO OFF
setlocal enableDelayedExpansion
FOR /F "tokens=1,* delims==" %%i IN (test.ini) DO (
SET sdone=0
SET "sname=%%i"
SET "svalue=%%j"
ECHO.Name: !sname!
ECHO.Value: !svalue!
:: write out headers
IF "!sdone!"=="0" IF "!sname:~0,1!"=="[" SET sdone=1&&ECHO.Type: Header&&ECHO.!sname!>>new.ini
:: write out the new value if it's client
IF "!sdone!"=="0" IF "!sname!"=="program status" IF "!svalue!"=="client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
IF "!sdone!"=="0" IF "!sname!"=="program status " IF "!svalue!"==" client" SET sdone=1&&ECHO.Type: Rewrite&&ECHO.!sname!=server>>new.ini
:: write out anything else
IF "!sdone!"=="0" SET sdone=1&&ECHO.Type: Content&&ECHO.!sname!=!svalue!>>new.ini
:: a little padding to read the debug info
ECHO.
)
At the end you'll want to add something to overwrite the original file, something like:
copy /y new.ini test.ini
edited Dec 23 '18 at 0:01
answered Dec 22 '18 at 19:47
shawn
1438
1438
There are no spaces in the INI so this actually works perfectly as I needed. Very Much appreciate your response.
– Terra Envy
Dec 26 '18 at 16:53
add a comment |
There are no spaces in the INI so this actually works perfectly as I needed. Very Much appreciate your response.
– Terra Envy
Dec 26 '18 at 16:53
There are no spaces in the INI so this actually works perfectly as I needed. Very Much appreciate your response.
– Terra Envy
Dec 26 '18 at 16:53
There are no spaces in the INI so this actually works perfectly as I needed. Very Much appreciate your response.
– Terra Envy
Dec 26 '18 at 16:53
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1386709%2ffind-and-replace-text-via-batch-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do the edited lines need to stay in order? Can we assume VBScript and cscript?
– harrymc
Dec 21 '18 at 16:49
Yes, it is an ini with about 100+ Lines and has to stay in order. And as stated, it can not include any extra files, installations, or downloads. Looking for a way in pure command line commands in a batch script. I am much more used to linux bash and still learning this stuff for windows. So correct me if I am wrong, but wouldn't a VBScript or cScript require additional files?
– Terra Envy
Dec 21 '18 at 17:02
1) When you add more information to answer a Comment, please click edit and add it to your original question, so the question contains all the information needed to explain the issue. Then, delete the Comment by clicking on the grey (S) at its end, for Comments can pile up and when they do, some Comments get hidden.
– K7AAY
Dec 21 '18 at 19:42
There is no native search text and replace commend in Windows. 2) For PCs w/ PowerShell, you can script w/ a command like cat program.ini | %{$<underscore> -replace "program status = client","program status = server"} (replacing <underscore> w/ a real underscore character.
– K7AAY
Dec 21 '18 at 19:50
3) For PCs w/ no PowerShell, suggest adding Open Source sed & its dependencies gnuwin32.sourceforge.net/packages/sed.htm to a temp directory (thereby avoiding any installation or change to the Registry), run a sed script in that directory for the task(s), then purge it & its dependencies as the last thing you do. 4) An alternative is Open Source FreeDOS edlin en.wikipedia.org/wiki/Edlin#Scripts It runs in Windows 10 x64 & x32 and earlier Windows versions. It allows simple search text and replace scripting. sourceforge.net/projects/freedos-edlin/files/latest/download
– K7AAY
Dec 21 '18 at 19:57