By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,276 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,276 IT Pros & Developers. It's quick & easy.

create subdir

P: n/a
Hi!,

Im am using the VB Express Beta2 but cannot figure out how to create a
subdir in the windows directory.

Code:

Dim windowsdir as String
Dim dircreate
dircreate="backup"
windowsdir=environ$("windir")
My.Computer.FileSystem.CreateDirectory(windowsdir)

I want to create the directory "backup" under the windows directory and i
don't want to use the absolute path, what am i missing?

Thanks.

Jacco

Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"DizWiz" <di****@dizwiz.com> schrieb:
Dim windowsdir as String
Dim dircreate
dircreate="backup"
windowsdir=environ$("windir")
My.Computer.FileSystem.CreateDirectory(windowsdir)

I want to create the directory "backup" under the windows directory and i
don't want to use the absolute path, what am i missing?


\\\
Imports System.IO
..
..
..
My.Computer.FileSystem.CreateDirectory( _
Path.Combine(Environ("windir"), "backup") _
)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2

P: n/a
Thanks for the reply, but solved it anothing way:
Dim winenv
Dim dircreate
winenv=environment.GetenvironmentVariable("windir" )
dircreate=(winenv)&"\backup"
My.Computer.FileSystem.CreateDirectory(dircreate)

Please comment

Jacco

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
"DizWiz" <di****@dizwiz.com> schrieb:
Dim windowsdir as String
Dim dircreate
dircreate="backup"
windowsdir=environ$("windir")
My.Computer.FileSystem.CreateDirectory(windowsdir)

I want to create the directory "backup" under the windows directory and i
don't want to use the absolute path, what am i missing?


\\\
Imports System.IO
.
.
.
My.Computer.FileSystem.CreateDirectory( _
Path.Combine(Environ("windir"), "backup") _
)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
"DizWiz" <di****@dizwiz.com> schrieb:
Dim winenv
Dim dircreate
winenv=environment.GetenvironmentVariable("windir" )
dircreate=(winenv)&"\backup"
My.Computer.FileSystem.CreateDirectory(dircreate)


I recommend to use types for variables, remove the braces around 'winenv'
and use 'Path.Combine' instead of the string concatenation operator.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

P: n/a
Thanks for you help, but when i use the following code:

System.Console.Write("Accept Systems - %windir% - backup")

My.Computer.FileSystem.CreateDirectory(Path.Combin e(Environ("windir"),
"backup"))

Name "path" is not declared

Jacco
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uC**************@TK2MSFTNGP12.phx.gbl...
"DizWiz" <di****@dizwiz.com> schrieb:
Dim winenv
Dim dircreate
winenv=environment.GetenvironmentVariable("windir" )
dircreate=(winenv)&"\backup"
My.Computer.FileSystem.CreateDirectory(dircreate)


I recommend to use types for variables, remove the braces around 'winenv'
and use 'Path.Combine' instead of the string concatenation operator.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

P: n/a
"DizWiz" <di****@dizwiz.com> schrieb:
Thanks for you help, but when i use the following code:

System.Console.Write("Accept Systems - %windir% - backup")

My.Computer.FileSystem.CreateDirectory(Path.Combin e(Environ("windir"),
"backup"))

Name "path" is not declared


That's why I said that 'Imports System.IO' is required in the file's
'Imports' list.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.