Jump to content
Sign in to follow this  
snowman533

[solved] File Protection script

Recommended Posts

snowman533

hey guys i am trying to make a peice of code that stops the attached program from running if the program is run from the program files or windows directory

if @ScriptDir = @WindowsDir Then
    MsgBox(0, "Error", "Sorting in any parts of the Windows folder will cause the computer to cease function, Terminating Program")
    Exit
    Else
if @ScriptDir = @ProgramFilesDir Then
    MsgBox(0, "Error", "Sorting in any parts of the program files section will cause programs to cease functioning, Terminating Program")
    Exit
    Endif
    Endif

now the code works fine if the script is run from the program files and windows directory, however i wish to include all subdirectories within the windows and program files directories

thanks in advance

Edited by snowman533

Intermediate AutoIt/Autohotkey User

Share this post


Link to post
Share on other sites
monoceres

Simple :D

If StringLeft(@ScriptDir,StringLen(@WindowsDir))=@WindowsDir Or StringLeft(@ScriptDir,StringLen(@ProgramFilesDir))=@ProgramFilesDir Then Exit

:o


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
snowman533

thanks :D

works perfect


Intermediate AutoIt/Autohotkey User

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×