Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


FileExtension Example Change

Keywords: FileExtension extension 

The example in FileExtension is correct but has a catch. The extension you are looking for must be in uppercase.
	i.e.
	If (ext == "COM") || (ext == "EXE") 
Complete Example:

	; prevent the user from editing a COM or EXE file
	allfiles = FileItemize("*.*")
	editfile = AskItemList("Select file to edit", allfiles, " ",@unsorted,  @single)
	ext = StrUpper(FileExtension(editfile))
	If (ext == "COM") || (ext == "EXE") 
        	Message ("Sorry", "You may not edit a program file")
	else
        	Run("notepad.exe", editfile)
	endif


Article ID:   W13068
Filename:   FileExtension Example.txt