Get and Set Current Directory in VB.NET

In this article I describe how to get and set the current directory.
  • 9181

Get and Set Current Directory

The SetCurrentDirectory method sets the specified directory as the current directory. The GetCurrentDirectory method returns the current directory.

Imports System.IO

Module Module1

    Sub Main()

        Dim root As String = "C:\Temp"

        Directory.SetCurrentDirectory(root)

        Console.WriteLine(Directory.GetCurrentDirectory())

        Console.ReadLine()

    End Sub

End Module

 

Output:

 get and set current directory in vb.jpg

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.