469,328 Members | 1,301 Online

How to find path for windows folder?

How can I find path of windows folder using vb.net? It could be winnt or
windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for
windows folder.
Jul 21 '05 #1
14 18097
This might work for you:

System.Environment.GetEnvironmentVariable("windir" )

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
How can I find path of windows folder using vb.net? It could be winnt or
windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for
windows folder.

Jul 21 '05 #2
Could you get the path for the "system" folder, then navigate one folder up?

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
How can I find path of windows folder using vb.net? It could be winnt or
windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for
windows folder.

Jul 21 '05 #3
Peter Rilling

How can i navigate one folder up?

"Peter Rilling" wrote:
Could you get the path for the "system" folder, then navigate one folder up?

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
How can I find path of windows folder using vb.net? It could be winnt or
windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for
windows folder.

Jul 21 '05 #4
CT

That didn't work

"CT" wrote:
This might work for you:

System.Environment.GetEnvironmentVariable("windir" )

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
How can I find path of windows folder using vb.net? It could be winnt or
windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for
windows folder.

Jul 21 '05 #5
By "navigate" I simply mean that once you have the path to the system
folder, you could then remove the right most folder to get the path to the
Windows folder, either by direct string manipulation of the path, or using
the Path class. This assumes that the system folder is under the Windows
folder, which I never seen it otherwise.

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Peter Rilling

How can i navigate one folder up?

"Peter Rilling" wrote:
Could you get the path for the "system" folder, then navigate one folder up?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
How can I find path of windows folder using vb.net? It could be winnt or windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for windows folder.

Jul 21 '05 #6
Have tried executing the internal set command in a command prompt? Does any
of the environment variables listed show the Windows folder?

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:0D**********************************@microsof t.com...
CT

That didn't work

"CT" wrote:
This might work for you:

System.Environment.GetEnvironmentVariable("windir" )

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
> How can I find path of windows folder using vb.net? It could be winnt
> or
> windows depending upon the os.
>
> System.Environment.SpecialFolder enumeration does not have a constant
> for
> windows folder.

Jul 21 '05 #7
Then get it from registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion | SystemRoot
"Peter Rilling" wrote:
By "navigate" I simply mean that once you have the path to the system
folder, you could then remove the right most folder to get the path to the
Windows folder, either by direct string manipulation of the path, or using
the Path class. This assumes that the system folder is under the Windows
folder, which I never seen it otherwise.

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Peter Rilling

How can i navigate one folder up?

"Peter Rilling" wrote:
Could you get the path for the "system" folder, then navigate one folder up?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
> How can I find path of windows folder using vb.net? It could be winnt or > windows depending upon the os.
>
> System.Environment.SpecialFolder enumeration does not have a constant for > windows folder.

Jul 21 '05 #8
Hi Peter

got it working as

Path.GetDirectoryName(Environment.SystemDirectory)

Thanks

"Peter Rilling" wrote:
By "navigate" I simply mean that once you have the path to the system
folder, you could then remove the right most folder to get the path to the
Windows folder, either by direct string manipulation of the path, or using
the Path class. This assumes that the system folder is under the Windows
folder, which I never seen it otherwise.

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Peter Rilling

How can i navigate one folder up?

"Peter Rilling" wrote:
Could you get the path for the "system" folder, then navigate one folder up?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
> How can I find path of windows folder using vb.net? It could be winnt or > windows depending upon the os.
>
> System.Environment.SpecialFolder enumeration does not have a constant for > windows folder.

Jul 21 '05 #9
Peter Rilling

How can i navigate one folder up?

"Peter Rilling" wrote:
Could you get the path for the "system" folder, then navigate one folder up?

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
How can I find path of windows folder using vb.net? It could be winnt or
windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for
windows folder.

Nov 22 '05 #10
CT

That didn't work

"CT" wrote:
This might work for you:

System.Environment.GetEnvironmentVariable("windir" )

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
How can I find path of windows folder using vb.net? It could be winnt or
windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for
windows folder.

Nov 22 '05 #11
By "navigate" I simply mean that once you have the path to the system
folder, you could then remove the right most folder to get the path to the
Windows folder, either by direct string manipulation of the path, or using
the Path class. This assumes that the system folder is under the Windows
folder, which I never seen it otherwise.

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Peter Rilling

How can i navigate one folder up?

"Peter Rilling" wrote:
Could you get the path for the "system" folder, then navigate one folder up?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
How can I find path of windows folder using vb.net? It could be winnt or windows depending upon the os.

System.Environment.SpecialFolder enumeration does not have a constant for windows folder.

Nov 22 '05 #12
Have tried executing the internal set command in a command prompt? Does any
of the environment variables listed show the Windows folder?

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:0D**********************************@microsof t.com...
CT

That didn't work

"CT" wrote:
This might work for you:

System.Environment.GetEnvironmentVariable("windir" )

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, AND MSF
http://www.apress.com/book/bookDisplay.html?bID=105

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
> How can I find path of windows folder using vb.net? It could be winnt
> or
> windows depending upon the os.
>
> System.Environment.SpecialFolder enumeration does not have a constant
> for
> windows folder.

Nov 22 '05 #13
Then get it from registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion | SystemRoot
"Peter Rilling" wrote:
By "navigate" I simply mean that once you have the path to the system
folder, you could then remove the right most folder to get the path to the
Windows folder, either by direct string manipulation of the path, or using
the Path class. This assumes that the system folder is under the Windows
folder, which I never seen it otherwise.

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Peter Rilling

How can i navigate one folder up?

"Peter Rilling" wrote:
Could you get the path for the "system" folder, then navigate one folder up?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
> How can I find path of windows folder using vb.net? It could be winnt or > windows depending upon the os.
>
> System.Environment.SpecialFolder enumeration does not have a constant for > windows folder.

Nov 22 '05 #14
Hi Peter

got it working as

Path.GetDirectoryName(Environment.SystemDirectory)

Thanks

"Peter Rilling" wrote:
By "navigate" I simply mean that once you have the path to the system
folder, you could then remove the right most folder to get the path to the
Windows folder, either by direct string manipulation of the path, or using
the Path class. This assumes that the system folder is under the Windows
folder, which I never seen it otherwise.

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Peter Rilling

How can i navigate one folder up?

"Peter Rilling" wrote:
Could you get the path for the "system" folder, then navigate one folder up?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
> How can I find path of windows folder using vb.net? It could be winnt or > windows depending upon the os.
>
> System.Environment.SpecialFolder enumeration does not have a constant for > windows folder.

Nov 22 '05 #15

Replies have been disabled for this discussion.