Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Question about creating dir

Question about creating dir

Scheduled Pinned Locked Moved Visual Basic
questionwindows-adminlinux
2 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User22022
    wrote on last edited by
    #1

    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?

    D 1 Reply Last reply
    0
    • U User22022

      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?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups