Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Is there a standalone .exe that can parse a certain text file with another file.
Like I have 4 files,
Good.txt
Results.txt
standalone.exe
batchfile.batI run the batch file, it produces Results.txt, then further in the batch file it used standalone.exe to parse results.txt with the contents of good.txt
Or can I make a batch file to do it?Example:
Results.txt
C:\test.txt
C:\test123.txt
C:\baddie.exeGood.txt
C:\test.txt
C:\test123.txtParsing...
Results.txt after parsing
C:\baddie.exe

How exactly are the files to be parsed? Parsing basically means that something is to be done to it by some sort of rules, without telling us what the rules are we can only imagine.

I would guess from the example that anything that isn't in the good list but is in the results should be displayed in the results.
I actually just made a script for something that does almost or exactly this. Let me test it first then I'll post it.
EDIT
yup a quick change to a script i just made works nicely.
--
@echo off
setlocal EnableDelayedExpansionset f1=H:\New Folder\results.txt
set f2=H:\New Folder\good.txt
set out=H:\New Folder\notgood.txtfor /f "usebackq tokens=*" %%a in ("%f1%") do (
set dif=2
for /f "usebackq tokens=*" %%b in ("%f2%") do (
if %%a==%%b set dif=1
)
if !dif!==2 echo %%a >> "%out%"
)
pause
----------------------set f1 to your results file
set f2 to your good file
set out to the parsed file name you would likeI can't think of a simple solution to just write the results to the result.txt file.
If you have both files and the batch script in one folder can just use the names where they are set and not the whole path.

Ok I think it works but after is parses, it says
ECHO is off.
where I told it to do this in the original batch file
echo. >> "%cd%"\SCKStemp.txt
Also there seems to be a problem with the echoing to a file with >>. Instead, the thing I wanted to be echoed it displayed on the command prompt.

Post a clear and detailed description on what your are trying to achieve and what problem you are stuck on along with any other relevant information, this is by far the fastest and most effective way to ask help.

For some reason this batch,
FOR %%G IN (
abc
123
tree
) DO (
dir C:\*.* /L /A /B /S|Find "%%G" >> "%cd%"\SCKStemp.txt
)
If not exist "%cd%"\SCKStemp.txt echo "Files not found" >> "%cd%"\SCKStemp.txt
start notepad "%cd%"\SCKStemp.txt
exitBrings up:
"Access is Denied" when it tried to open up the text file at the end. Why?

Because you have quotes on the directory with the file name after it.
This should fix it:
If not exist "%cd%\SCKStemp.txt" echo "Files not found" >> "%cd%\SCKStemp.txt"
start notepad "%cd%\SCKStemp.txt"You should also be able to get away with just specifying the file name because the current directory will be assumed:
If not exist SCKStemp.txt echo "Files not found" >> SCKStemp.txt
start notepad SCKStemp.txt

I Went into the command prompt and tried this,
C:\>"%cd%"\wizard.txt
C:\>"%cd%\wizard.txt"
and they both worked. So why do I have to do the second one?

[edit: I was wrong, it was start and not notepad]
Because start won't tolerate it, technically double quotes are illegal characters in file and folder names. For example if cd were the %userprofile% on xp (c:\documents and settings\<user>) then "%cd%"\SCKStemp.txt would expand to "c:\documents and settings\<user>"\SCKStemp.txt.
Start only seems to accept what's inside the quotes as a file name because it's more strict about the illegal character. Notepad obviously can't open directories, if you try it gives the "access denied" message and starts a new "untitled" document. Because your only supplying a directory name within the qoutes notepad is saying "I can't open a directory". You will get the same message for "start notepad c:".

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |