Search found 18 matches
- 01 Feb 2011 17:50
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
:SEARCH set /p buildPatch=Enter the build and patch level: set /p choice=Enter the search word or phrase to find the QF: dir /ad /b | findstr /i /c:"%buildPatch%" > "%myPath%\temp.txt" set myTemp="%myPath%temp.txt" explorer %CD% setLocal EnableDelayedExpansion for /f &...
- 31 Jan 2011 14:51
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
OK. I just had to use a nested for loop, type format. Everything is working like I wanted now. I'm just fixing it up a bit, I'll post the code to the search function tonight, in case it will help anyone else who may be doing something similar.
Thanks again, to everyone who gave me feedback.
Thanks again, to everyone who gave me feedback.
- 29 Jan 2011 19:55
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
I tried that already, just echoing the CD after findstr, however it was giving me weird results. Ill have to wait until I'm back at work on monday, as I didnt save my code this time, and i dont have access to the networked drive, etc from home.
- 29 Jan 2011 12:58
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
Ok, just an update here on what all is working now. I have everything working fine, it is searching by the first variable, and then only searching txt files based on that. Heres what I have so far. set /p buildPatch=Please enter the build and patch: dir /ad /b | findstr /i /c:"%buildPatch%"...
- 28 Jan 2011 16:35
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
So, this first part returns the output that I need. dir /ad /b | findstr /i /c:"%buildPatch%" So now, I just need to use the other piece of code to search the folders returned by the above code, to look for my %choice% variable within any txt files in the subfolders. Should have gone about...
- 28 Jan 2011 16:25
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
The only issue is, that %choice% variable, is going to be a txt file within any number of subfolders. so have to use the /s option, but whenever I do this.. it doesnt work. It shows all the text files that contain the choice variable. BUT it doesnt ONLY search the folders that include the keyword fr...
- 28 Jan 2011 13:39
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
This is probably because I don't understand the for /f functionality. So basically I need to break it down to a nested for loop or rather just 2 separate for loops? first start out with the dir /ad /b /s | findstr "%buildPatch%. and take the output of that (each folder path) into a temp file. t...
- 27 Jan 2011 18:31
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
I resolved quite a few issues I was having with this batch file thanks to much help from the posts here. However, still having an issue with this particular line, or maybe it's not possible to work in the way I want it to. setLocal EnableDelayedExpansion for /f "tokens=* delims= " %%a in (...
- 27 Jan 2011 08:24
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
Yes, sadly. My issue has changed throughout the process due to learning more about how horrible the folder structure is on the networked drive and how most of the folders are named in different formats.
I'll try out the code you posted when I get to work later.
Thanks
I'll try out the code you posted when I get to work later.
Thanks
- 26 Jan 2011 21:38
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
So you are saying the following should work how I was trying to explain it. for /f "tokens=* delims= " %%a in ('dir /ad /b /s | findstr "%buildPatch%" ^|^ FINDSTR /s /i /L /M /c:"%choice%" *.txt') do ( set /a n+=1 set v!n!=%%a echo %%a and then something like %%a > temp...
- 26 Jan 2011 21:36
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
the drive to be searched is read only. their own harddrive where the folder the batch file is kept has write access though. I guess a temp file could be made there.
Also, yes there are many folders. one of the versions alone has 60+ folders in it with different patches, etc.
Also, yes there are many folders. one of the versions alone has 60+ folders in it with different patches, etc.
- 26 Jan 2011 19:42
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
I appreciate the replies all. I have another question, i cant seem to figure this out after reading over the dir , findstr and for /f functions. So i cant use a temp file due to read only access restrictions all the machines have that this batch file will be run from. just an fyi, for any responses....
- 22 Jan 2011 19:23
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
OK. nevermind the last post. It isn't going to be possible to have it search the different directory. as it isn't local on the harddrive, and i didnt have access to it by just doing CD \thepath Sooo. Ill just have to get approval to have my batch file (once complete) placed in that root directory of...
- 21 Jan 2011 18:37
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
Another question here regarding the same code. Here's what I have so far. This isn't going to be my final result, but it works so far the way i want it to(on my pc at least) @echo off :SEARCH set /p choice=Enter the search word or phrase to find the QF: FINDSTR /s /i /L /M /c:"%choice%" *....
- 21 Jan 2011 13:04
- Forum: DOS Batch Forum
- Topic: string manipulation help
- Replies: 30
- Views: 32910
Re: string manipulation help
Well, the reason behind the temp.txt is that im going to end up giving the user a choice whether they want to open 1 of the text files that was found, or 1 at a time. If 3 are found, I don't want all 3 to open, unless they do it 1 at a time. (this will be incorporated later using a listbox in a vb o...