shadowbrokers-exploits/windows/Resources/Ep/Scripts/Include/_FileExists.epm
2017-04-14 11:45:07 +02:00

45 lines
1.2 KiB
Text

#-------------------------------------------------------------------------------
# _FileExists
# Determines if a file exists, or if any files match a mask
# Params:
# file - the file or mask to look for
#-------------------------------------------------------------------------------
Sub _FileExists(IN STRING $file)
{
return _FileExists($file, "");
} /* end _FileExists (no path) */
#-------------------------------------------------------------------------------
# _FileExists
# Determines if a file exists, or if any files match a mask
# Params:
# file - the file or mask to look for
# path - where to look (can be "")
#-------------------------------------------------------------------------------
Sub _FileExists(IN STRING $file, IN STRING $path)
{
@echo off;
@record on;
bool $ok;
if(StrLen($path) == 0)
{ $ok = `dir "$file"`; }
else
{ $ok = `dir "$path\\$file"`; }
@record off;
ifnot($ok)
{ return false; }
string $name = GetCmdData("name");
ifnot(defined($name))
{ return false; }
if(sizeof($name) < 1)
{ return false; }
@echo on;
return true;
} /* end _FileExists (path) */