October 29, 2000 - Finding the File's Drive Letter | WebReference

October 29, 2000 - Finding the File's Drive Letter

Yehuda Shiran October 29, 2000
Finding the File's Drive Letter
Tips: October 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

An Internet Explorer JavaScript script might need to find the drive letter of a file argument. To find out a file's drive letter, use the drive property of the File object. Here is a piece of script that will print the file's creation date:

<SCRIPT LANGUAGE="JavaScript">
<!--
  myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
  file = myActiveXObject.GetFile("f:\\test.txt");
  alert(file.drive);
// -->
</SCRIPT>

Here is the alert box you will get: