Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Executing DOS commands using VBScript

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62815
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Executing DOS commands using VBScript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Executing DOS commands using VBScript - 7/27/2008 3:08:57 AM   
  anshulsood


Posts: 3
Score: 0
Joined: 7/27/2008
Status: offline
Hi
I'm trying to execute a vbscript which copies content from file server to another client machine, I
m using client IP add as input variable "ipAdd". But the following code does not execute. Please help me.
Code goes here:

Dim ipAdd
ipAdd = InputBox("Enter the IP address:")
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "CMD /K CD C: & COPY \\some_ip_address\appsxp\jre.1.6.0\Files\JRE.1.6.0.EXE \\&ipAdd\C$"
Set wshShell = Nothing
'Finish

Thanks,
Anshul.
 
 
Post #: 1
 
 RE: Executing DOS commands using VBScript - 7/27/2008 3:53:52 AM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline

      


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to anshulsood)
 
 
Post #: 2
 
 RE: Executing DOS commands using VBScript - 7/27/2008 3:57:06 AM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi anshulsood,

if you want to put the value of a variable into a VBScript string (literal), you'll have
to use concatenation:

   sPutItIn = "insert me"
   sNewString = "the part before" & sPutItIn & "the part after"

Compare this to:

   ....EXE \\&ipAdd\C$"

and act accordingly.

Good luck!

ehvbs

(in reply to anshulsood)
 
 
Post #: 3
 
 RE: Executing DOS commands using VBScript - 7/28/2008 3:50:33 PM   
  anshulsood


Posts: 3
Score: 0
Joined: 7/27/2008
Status: offline
Thanks for the solution. I was trying to for last one week, I need to learn a lot from you guys.

Thanks,
Anshul.

(in reply to anshulsood)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Executing DOS commands using VBScript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts