/bundles/itninjaweb/img/Breadcrumb_cap_w.png
suppose i want to search a specific word in the autoexec.bat or any file how can I achieve that through scripting
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

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.
Answered 03/17/2004 by: usachrisk
Purple Belt

Please log in to comment
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
Answered 04/17/2004 by: guard
Senior Yellow Belt

Please log in to comment