469,328 Members | 1,301 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

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
CT
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
CT
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
jk
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
CT
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
jk
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

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Bell, Kevin | last post: by
1 post views Thread by Anand G | last post: by
2 posts views Thread by Kevin | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.