CurrentDirectory Property


CurrentDirectory Property

Location

My.Computer.FileSystem.CurrentDirectory

Syntax

     Dim result As String = My.Computer.FileSystem.CurrentDirectory 

or:

     My.Computer.FileSystem.CurrentDirectory = path 


path (required; String)

The full or relative path to a valid directory to use as the new "current" directory

Description

The CurrentDirectory property returns the full path to the "current" directory, the directory used when referring to files with relative path names. This property can also set the current directory to a new path.

Usage at a Glance

  • An exception is thrown if the user lacks sufficient privileges to examine the file system, or at least the specified part of the file system.

  • An exception is thrown when setting this property if the supplied path is invalid.

Example

This sample code shows the basic functionality of the CurrentDirectory property.

     My.Computer.FileSystem.CurrentDirectory = "c:\Windows\System32"     My.Computer.FileSystem.CurrentDirectory = ".."  ' Up one level     MsgBox(My.Computer.FileSystem.CurrentDirectory)    ' ----- Displays "c:\WINDOWS" 

Related Framework Entries

  • Microsoft.VisualBasic.MyServices.FileSystemProxy.CurrentDirectory Method

  • Microsoft.VisualBasic.FileIO.FileSystem.CurrentDirectory Method

  • System.IO.Directory.GetCurrentDirectory Method

See Also

Drives Property, FileSystem Object, FindInFiles Method, GetDirectories Method, GetDirectoryInfo Method, GetDriveInfo Method, GetFileInfo Method, GetFiles Method, GetTempFileName Method




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net