Question about creating dir
-
Hello everyone, i am trying to use powershell in vb6 to create directory.However when i run the compiled file, nothing happened. I am using this code
Shell "cmd.exe /c powershell New-Item \\?\C:\Windows \System32 -ItemType Directory"
Note that, after "\windows there is space between the slash(this is intentional). I even tried with CMD
Dim command As String
command = "md \\?\C:\Windows \System32"Shell "cmd.exe /c command"
Any suggestions?
-
Hello everyone, i am trying to use powershell in vb6 to create directory.However when i run the compiled file, nothing happened. I am using this code
Shell "cmd.exe /c powershell New-Item \\?\C:\Windows \System32 -ItemType Directory"
Note that, after "\windows there is space between the slash(this is intentional). I even tried with CMD
Dim command As String
command = "md \\?\C:\Windows \System32"Shell "cmd.exe /c command"
Any suggestions?
1. Stop using VB6. It's been dead for over 20 years now. 2. The path you specify should not start with "\\?\". 3. The folders should not already exist. Trying to create C:\Windows or C:\Windows\System32 will fail as they already exist. 4. The Windows and Windows\System32 folders are protected from being written to by normal users. Any attempt to create folders or files in these folders will fail. 5. If I remember correctly (I haven't touched VB6 in over 20 years!) you don't even need Shell to do it. You can just do
MkDir "C:\\MyFolder"
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak