Finding 'WSCRIPT.EXE' or 'CSCRIPT.EXE' Files |
Due to stupidity (on a monumental scale) you should be very careful when searching for Microsoft Windows system files (such as "WSCRIPT.EXE") otherwise you could find the program in "C:\WINDOWS\$NtServicePackUninstall$" or "C:\WINDOWS\system32\dllcache" or similar (they are not compressed or hidden in any way).
A depth of "0" should be specified when searching for the Windows files in "WindowsFolder" and "SystemFolder". If you do find the file in the wrong place also sorts of "weird" problems can result.
Even more stupidity applies to some files (and "WSCRIPT.EXE" is an example of this) in that they can be found in different locations in different versions of Windows! To handle this you need to do multiple "0" depth searches (with the "Default" parameter equal to "" and followed up by a "AbortIf" command)
The following demonstrates this:
;################################################################################## ;### Note that I have now created a "FileFindInListedDirs" command ;### which simplifies this and makes it more generic: ;### <$FileFindInListedDirs File="wscript.exe" DIRS="System64Folder;SystemFolder;WindowsFolder"> ;################################################################################## ;---------------------------------------------------------------------------- ;--- Macro to find "WSCRIPT.EXE" ;--- MS stupidly places this file in logically different locations ;--- ("C:\windows" in WIN98). Also just to make it more difficult it is not ;--- possible to search by attribute, or search path and thus not possible ;--- to avoid possible incorrect matches in fixpack backup directories. ;--- All in all nearly a handful of reasons to swear at MS in one go.... ;---------------------------------------------------------------------------- #( #define WSCRIPT.EXE ;--- Can't do this! Can find files in "$NtServicePackUninstall" type directories --- ;<$FileFind File="WSCRIPT.EXE" Property="WSCRIPT.EXE" PATH="[WindowsFolder]" Depth="1"> ;;Danger, Danger... ;--- Thanks MS... ------------------------------------------------------- <$FileFind File="WSCRIPT.EXE" Property="WSCRIPT.EXE.WF" PATH="[WindowsFolder]" Depth="0" Default=""> <$FileFind File="WSCRIPT.EXE" Property="WSCRIPT.EXE.SF" PATH="[SystemFolder]" Depth="0" Default=""> <$PropertyCa "WSCRIPT.EXE" Value="[WSCRIPT.EXE.WF]" Seq="AppSearch-" Condition="WSCRIPT.EXE.WF and (<$CONDITION_EXCEPT_UNINSTALL>)" SeqTable="InstallUISequence InstallExecuteSequence"> <$PropertyCa "WSCRIPT.EXE" Value="[WSCRIPT.EXE.SF]" Seq="AppSearch-" Condition="WSCRIPT.EXE.SF and (<$CONDITION_EXCEPT_UNINSTALL>)" SeqTable="InstallUISequence InstallExecuteSequence"> <$AbortIf Condition="not WSCRIPT.EXE and (<$CONDITION_EXCEPT_UNINSTALL>)" Message=^The file "WSCRIPT.EXE" was not found in the "[WindowsFolder]" or "[SystemFolder]" directories!^ SeqTable="InstallUISequence InstallExecuteSequence" Seq="AppSearch-" > <$PropertyList "SecureCustomProperties" Value="WSCRIPT.EXE"> #)