/build/static/layout/Breadcrumb_cap_w.png

Searching a specific word

suppose i want to search a specific word in the autoexec.bat or any file how can I achieve that through scripting

0 Comments   [ + ] Show comments

Answers (2)

Posted by: usachrisk 20 years ago
Purple Belt
0
Depends on what you're scripting with, what OS you're running on, and what you want to do with the output. If you're doing a batch file or another script that will run at a command line, you can use the FIND command. An example could be:

@echo off
cls
FIND C:\MYFILE.TXT "CHRISTOPHER"
IF %ERRORLEVEL% == 0 GOTO FOUND
echo Sorry, couldn't find CHRISTOPHER in C:\MYFILE.TXT
goto end

:FOUND
echo Found CHRISTOPHER in C:\MYFILE.TXT!

:end

If you're using the SMS Installer, there is the script item that will read a file, and the one that can parse a string variable that would do the trick. The list goes on.

Chris.
Posted by: guard 20 years ago
Senior Yellow Belt
0
Find.exe or FindStr.exe will work.

See cross platform (NT, 2000, XP, Server 2003) syntax at

http://TheSystemGuard.com/TheGuardBook/CCS-Ext/Find.htm
http://TheSystemGuard.com/TheGuardBook/CCS-Ext/FindStr.htm
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ