0

I am working on some legacy VB6 code and I am having my program break with this message:

enter image description here

and it then highlights this code:

enter image description here

I know that the specified locations exist per these screenshots:

enter image description here enter image description here

I am running this Visual Studio 6.0 on a 64-bit Windows 7 machine. How can I make the program see shell?

jth41
  • 3,808
  • 9
  • 59
  • 109
  • Are you sure FileServer & "\public\Drafting" exists? – Bathsheba Jun 07 '13 at 14:07
  • 1
    You do know that `command.com` is very legacy and old? You should use `%comspec%` or `cmd.exe` or the required command directly if it's an executable. – Deanna Jun 07 '13 at 22:49
  • In addition to the already posted answers you may also need to be running your process elevated in order to achieve what you want – Matt Wilko Jul 24 '13 at 14:17

3 Answers3

4

command.com does not exist on 64 bit windows.

Try using C:\Windows\SysWOW64\cmd.exe instead. C:\Windows\SysWOW64 is a folder giving you backwards compatibility stuff for 32 bit.

But see the comment below (taken from Euro Micelli).

Really you should use %SYSTEMROOT\System32\cmd.exe instead. First, Windows is not always installed in C:\Windows; you should let the system figure that out. Second, using System32 is always correct for a 32-bit application: when running on Win32, it is the correct folder; when running on Win64, Windows will map %SYSTEMROOT%\System32 to %SYSTEMROOT%\SysWOW64

Bathsheba
  • 231,907
  • 34
  • 361
  • 483
  • 2
    Actually, you should use `%SYSTEMROOT\System32\cmd.exe` instead. First, Windows is not always installed in `C:\Windows`; you should let the system figure that out. Second, using System32 is always correct for a 32-bit application: when running on Win32, it is the correct folder; when running on Win64, Windows will map `%SYSTEMROOT%\System32` to `%SYSTEMROOT%\SysWOW64` for you. – Euro Micelli Jun 07 '13 at 15:32
  • Indeed Euro Micelli, I'll amend the answer. Sorry, was being a little lazy; Friday after all. – Bathsheba Jun 07 '13 at 15:35
2

I use vb6 and windows 7.

I've done the same thing as you but I put the dos command in a bat file.

Login.bat

NET USE W: \\10.48.10.8\e$

Then in the code Shell ("c:\login.bat")

John Moore
  • 511
  • 1
  • 9
  • 23
  • 2
    Note that there is a VERY big difference between DOS and the command line interface to Windows! – Deanna Jun 07 '13 at 23:10
1

The vb command is not correct for the OS that you are running. You need to check that that drive is not already mapped, and remove the command.com /c from the command that you are trying to execute.

nate
  • 1,418
  • 5
  • 34
  • 73