The GetFileName() method gets a specified filename.
This method takes filename as its only parameter.
<html> <body> <script language="JScript"> <!-- function getname() { var myObject, name; myObject = new ActiveXObject("Scripting.FileSystemObject"); name = myObject.GetFileName("c:\test.txt"); alert("The file name is:" + name); } --> </script> Get the name value for the file "test.txt" <form name="myForm"> <input type="Button" value="Get File Name" onClick='getname()'> </form> </body> </html>