Solved

Difference between vb-scripts WScript.Shell and cmd.exe

Posted on 2008-10-16
4
1,755 Views
Last Modified: 2012-05-05
I have a command that works perfectly in command-prompt (cmd.exe), but when I run it in a vb-script it does not work. What is the difference between WScript.Shell and cmd.exe? The command Im running is:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "runas /user:"& user & " " & chr(34) & share & "\DOM_Mallar\Script\Robocopy.exe " & share & "\DOM_Mallar " & ProgramFiles & "\DOM_Mallar  /MIR /E /W:0 /R:2 /XD *Script*  > " & ProgramFiles & "\DOM_Mallar\cp_mallar.txt" & chr(34) & " | " & share & "\DOM_Mallar\script\sanur " & pwd
Set WshShell = WScript.CreateObject("WScript.Shell") 
WshShell.Run "runas /user:"& user & " " & chr(34) & share & "\DOM_Mallar\Script\Robocopy.exe " & share & "\DOM_Mallar " & ProgramFiles & "\DOM_Mallar  /MIR /E /W:0 /R:2 /XD *Script*  > " & ProgramFiles & "\DOM_Mallar\cp_mallar.txt" & chr(34) & " | " & share & "\DOM_Mallar\script\sanur " & pwd

Open in new window

0
Comment
Question by:einarbrown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 22730046
Try passing it through cmd...

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c runas /user:"& user & " " & chr(34) & share & "\DOM_Mallar\Script\Robocopy.exe " & share & "\DOM_Mallar " & ProgramFiles & "\DOM_Mallar  /MIR /E /W:0 /R:2 /XD *Script*  > " & ProgramFiles & "\DOM_Mallar\cp_mallar.txt" & chr(34) & " | " & share & "\DOM_Mallar\script\sanur " & pwd
0
 
LVL 6

Author Closing Comment

by:einarbrown
ID: 31506676
Thanks allot! It workt!
0
 
LVL 6

Author Comment

by:einarbrown
ID: 22730454
It worked perfectly to pass it through cmd!

Thanks!
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22730921
Happy to help - thanx for the grade! :^)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question