Saved Bookmarks
| 1. |
Solve : Using Findstr /x can't find exact match.? |
|
Answer» When using: C:\Temp>echo X>>file.txt Quote The echo places a space and newline character after the "X" How do you know that? I suspect it inserts carriage-return and LINE-feed characters. What version of the command PROMPT are you using? OK having tried to go through this step by step logically i can't see what's going on... maybe it's something to do with having more than one string in the file my actual code looks like this: Code: [Select] findstr /x /i %comm% %CD%\users\current\software.dat >num.dat where %comm% is a user defined variable and the file software contains: "help list telnet account bbs cracker " when i write a test script to find out what's wrong it sometimes works and sometimes doesn't I suspect your right it's probably a carriage return and line-feed and i don't know what version, im using Vista so i guess the latest?I suspect the lines it doesn't work for are the first and last lines. You only have one word per line. Why even use the /x switch? The /i switch makes it case insensitive, which is not an exact match anyway. Code: [Select]@echo off set comm=help findstr /i "%comm%" %CD%\users\current\software.dat >num.dat |
|