1.

Solve : 3 questions?

Answer»

1. How can i make bat wich will make files in RANDOM folders ?
2. It is possible to code/decode text e.g. in rot13 ??
i DONT wont do it in "for" etc
3. How to FIND in files text from one word to other ?
like i wont to find tex2 form txt1 to txt3
Code: [Select]txt1 txt2 txt3thanks in advance
our friend Dusty says me to post config etc
so:
Vista/XP
4gb RAM
Intel QX6850
Striker Extreme
2x 8800Ultra OC SLIAnybody know?? Please1)
mkdir %random%

2)unsure about in the command window but otherways easily google it

3)use findstr string file.txt unsure what you mean "one word to other"

example:
cd\myfiles
findstr /I Titlename *.txt

would SEARCH *.txt (all text files) in (myfiles) folder, and display ones with "Titlename" in them /I is ignore string casethanx!
but about the 3 question. I wont to find "some text" in EG test.txt betwen "before word" to "after word"
"before word" "some text" "after word" You will need to use the regular expression function in FindStr
Type FindStr /? at the command prompt to see the options

If you only want to find 'myword' between 'firstword' and 'lastword', separated only by a single space, then you can search for

firstword myword lastword

But if there are varying amounts of space, commas tabs etc between, then the regular expression is the way to go

GrahamYes but what will be if i dont have 'myword' but the odershere's some vbscript code to get you started.
Code: [Select]' 1) create directory with random number
Randomize
numRandom = Int((65535 * Rnd) + 1)
WScript.Echo numRandom
Set objFSO=CreateObject("Scripting.FileSystemObject")
objFSO.CreateFolder("C:\temp\" & numRandom) 'create directory

'2) rot13 encrypt
strInput = "testing"
n = 13
For i = 1 To Len(strInput)
strConverted = Chr(Asc(Mid(strInput, i, 1)) + n)
WScript.StdOut.Write(strConverted)
Next


'2) rot13 decrypt
strInput = "testing"
n = 13
For i = 1 To Len(strInput)
strConverted = Chr(Asc(Mid(strInput, i, 1)) - n)
WScript.StdOut.Write(strConverted)
Next

WScript.Echo

' 3) find words between 2 words
strTest = "txt1 tex2 txt2"
indexFirstWord = InStr(1,strTest,"txt1")
WScript.Echo indexFirstWord
indexSecondWord = InStr(1,strTest,"txt2")
WScript.Echo indexSecondWord
indexstart = indexFirstWord + Len("txt1")
strWordBetween = Trim(Mid(strTest,indexstart,indexSecondWord - indexstart))
WScript.Echo strWordBetween
that 3 is impossible in .bat file ?? coz i cant make it work in vbs



Discussion

No Comment Found