472,779 Members | 2,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 software developers and data experts.

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 18287
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bell, Kevin | last post by:
I'd love to be able to open up a windows folder, like c:\temp, so that it pops up visually. I know how to drill down into a directory, but I can't figure out how to open one up on screen. Would I...
2
by: A.M-SG | last post by:
Hi, How can I find the temp folder on the user's machine? Is there any class that returns me a unique temporary file name? Thank you, Alan
1
by: Anand G | last post by:
All, How do I share Windows folder programatically? Which namespace/class to look for? Thanks in advance for your help. regards, Anand
0
by: Jason Madison | last post by:
Having installed VS 2005 SP 1 whenever I logon to Windows, the Windows Folder now opens automatically. Any ideas why this happens and how to stop it?
2
by: soledaddanh | last post by:
How can i get path of folder by its name in one folder?
1
by: Rick | last post by:
Can you help me figure out how i can open a windows folder from code? I want a user to click a button to open a windows folder as you would when you click on a folder in "My Computer". ...
2
by: Kevin | last post by:
I'm trying to use a command button to open a windows folder related to the current record. The record has a Location field that contains the name of the windows folder, in the current directory...
12
by: tvnaidu | last post by:
Trying to mount windows folder on Linux machine, getting this error. I have a folder called "CheckIn" on windows, I made that folder as Network sharing. ON lInux, I tried to access that folder by...
1
by: Roger Housden | last post by:
I need to rename a series of files that are both referenced in a PLMXML file and are physically located in a Windows folder. I think that command "regx" or "regxPattern" might be able to do this. ...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.