jalymo
asked on
Shell cmd not working
The following Shell command does nothing when executed:
x = Shell("net user /domain xyz >c:\mydocs\valid\lanuserho ld\xyz.txt ", 0)
If I execute the same command via bat file it works:
x = Shell("c:\mydocs\valid\Lan UserHold\t estbat.bat ", 0)
The test.bat file contains:
net user /domain xyz >c:\mydocs\valid\lanuserho ld\xyz.txt
exit
Although it is executed in an Access module, I figured the VB code area would be a better place to post question. Any ideas?
x = Shell("net user /domain xyz >c:\mydocs\valid\lanuserho
If I execute the same command via bat file it works:
x = Shell("c:\mydocs\valid\Lan
The test.bat file contains:
net user /domain xyz >c:\mydocs\valid\lanuserho
exit
Although it is executed in an Access module, I figured the VB code area would be a better place to post question. Any ideas?
ASKER
Erick37 --
Tried both but they did not work. As I am using an NT workstation, I referenced "c:\winnt\system32\command .com" for your first option.
I tried vbNormalFocus to see if there were any error messages, but the sceen whips by so fast, I can't see anything.
Tried both but they did not work. As I am using an NT workstation, I referenced "c:\winnt\system32\command
I tried vbNormalFocus to see if there were any error messages, but the sceen whips by so fast, I can't see anything.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
forgot
x = Shell("c:\winnt\system32\c md.com /k" & " net user...
Add the /k to keep the window open after executing to see your error messages...
x = Shell("c:\winnt\system32\c
Add the /k to keep the window open after executing to see your error messages...
ASKER
way to go mmips --- the cmd.exe did it!
or
x = Shell(Environ("COMSPEC") & " net user ...