Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want batch file search in file if have small english letters and numbers only it will send him to fin and if he have symbol different than small english letters and numbers it will send him to end

for example:

set /p test=enter password
echo %test%>123.txt
findstr /m "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0"
if %errorlevel%==0 goto fin
if %errorlevel%==1 goto end
:fin
echo your password have small english letters and numbers
pause
exit
:end
echo your password have symbol different than small english letters and numbers
pause
exit
Posted

1 solution

If you look at the findstr description: http://technet.microsoft.com/en-us/library/bb490907.aspx[^] your code is not going to work, or even close to.

The format for findstr is:
FINDSTR [options] string filename
Your code doesn't include the file, so it has nothing to serach, and it is looking for an exact match on an 'a', followed by a comma, followed by a 'b', followed by a comma, followed by...

Instead try:
FINDSTR /m "[abcdefghijklmnopqrstuvwxyz0123456789]+" 123.txt
I don't guarantee it will work, but it stands a better chance than your version! :laugh:
 
Share this answer
 
Comments
xxv2012 18-Jan-14 5:23am    
not working
OriginalGriff 18-Jan-14 5:43am    
That is not a helpful description of a problem: what did it do that you didn't expect or not do that you did?
xxv2012 18-Jan-14 8:25am    
the description is show the problem if you not understand i will explain to you
i want batch file to search in the file if have symbol or capital english letters it will send hem to end (until if have small english letters or nummbers for examble te%st,tEst) and if the file have small english letters and numbers it will send hem to fin (for examble test)
OriginalGriff 18-Jan-14 8:37am    
Yes...I kinda got that bit.
But when I give you a "code fragment" and your response is "not working" it doesn't exactly help me pinpoint exactly what it does or doesn;t do in your environment.

It's like phone the garage, saying "my car broke" and putting the phone down. It doesn't mean the garage will rush to your side with the appropriate bits and equipment to fix it: they don;t know who you are, where you are, what your car is, or any idea of what might be wrong with it...
xxv2012 18-Jan-14 10:50am    
when you type code you must be Sure it working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900