What's wrong

February 18, 2010 at 09:08:18
Specs: Windows XP, 1GHz/256mb
Why this code is not working.. ?

for /F %%f in ('dir 'D:\Program Files\b.exe' /s /b') do echo D:\ disk virus scan results: >> virscan.log
for /F %%f in ('dir 'D:\Program Files\b.exe' /s /b') do echo Threat type: SUSPICIOUS >> virscan.log
for /F %%f in ('dir 'D:\Program Files\b.exe' /s /b') do echo Status: QUARANTINED >> virscan.log
for /F %%f in ('dir 'D:\Program Files\b.exe' /s /b') do msg * SUSPICIOUS FILE FOUND!
for /F %%f in ('dir 'D:\Program Files\b.exe' /s /b') do msg * SUSPICIOUS FILE quarantined!
for /F %%f in ('dir 'D:\Program Files\b.exe' /b') do move /Y %%f C:\quarantine

it says system can't find file specified etc.


See More: Whats wrong

Report •


#1
February 18, 2010 at 09:11:57
Exchange the single quotes(') around the the file names(d:\program files\....) with double quotes(").

Report •

#2
February 18, 2010 at 09:19:39
Just what I was going to suggest. You cant mix single quotes in the same line. It just get everything confused as to where one ends and the other starts.

Stuart


Report •

#3
February 18, 2010 at 09:21:54
PathName/FileName with embedded blanks must be embraced by double quotes (") NOT single quotes ('), i.e.

"D:\Program Files\b.exe"

and so on... you have to embrace internal variables too that may be assigned those nasty values as move /Y "%%f".

GENETIC, you are trying too hard for your knowledge of batch scripting.


Report •

Related Solutions

#4
February 18, 2010 at 10:18:07
Yeah, anybody who can't get basic commends has about *NO* chance of "programming anti-virus"[sic].


=====================================
Helping others achieve escape felicity

M2


Report •

#5
February 18, 2010 at 12:33:02
Yeah I know.. I'm not trying to make good AntiVirus.. Btw its very simple, I just want to finish it, on my free time.. I solved problem with: %systemdrive%\progra~1
Sorry for bad english I'm from Lithuainia

Report •

#6
February 18, 2010 at 15:41:16
I'd rather start on a program that simulates a human opponent in a game of chess ... but, go ahead. Let us know when you have finished !

Report •

#7
February 21, 2010 at 11:23:21
Ok. I want to write msg command that shows sentence with symbol "!"
I wrote in batch file: msg * Setup successful!
but when message box pops-up it shows Setup successful ( without symbol "!" )
Where is mistake?


Report •

#8
February 21, 2010 at 13:56:28
the "enabledelayed" kills the !. You have to temporarily disable it prior to the message:
setlocal disabledelayedexpansion
echo test!
setlocal enabledelayedexpansion
echo test!

i don't think you lose any var. values by disabling.


Report •

#9
February 22, 2010 at 04:54:47
Consider using "enabledelayedexpansion" only during the FOR /F loop(s).

Report •

#10
February 26, 2010 at 06:10:19
Ok. I'm finished it, but it's in beta version for now. Just for test. If you want, you can download it from: http://www.mediafire.com/?ywitmcmjfxt

Please not tell me, that it's crap. I already know this.


Report •

#11
February 26, 2010 at 07:06:21
He he

No offense intended, just a warning about just how secure .bat converters are ;)


If you want me to remove the post just let me know.

BTW:

Delayed expansion + ! = ^^!


Report •

Ask Question