Computing.Net > Forums > Programming > Easy VB Quetion

Easy VB Quetion

Reply to Message Icon

Original Message
Name: questioned
Date: May 29, 2008 at 16:19:20 Pacific
Subject: Easy VB Quetion
OS: Win Xp
CPU/Ram: 2GB
Model/Manufacturer: i unno
Comment:

I am trying to execute a batch file from the VB script, I've tried the shell commands but nothing seems to work. I need to open a file that is in Directory.Text & "/copy.bat", with Directory.Text being the text value the user inputs. Shell (Directory.Text & "/copy.bat") doesn't work...

If anyone knows,..help appreciated

Noobs R ME


Report Offensive Message For Removal

Response Number 1
Name: StuartS
Date: May 29, 2008 at 17:10:53 Pacific
Subject: Easy VB Quetion
Reply: (edit)

Directory.text should contain the path name of the folder where copy.bat resides. i.e C:\Users\MyDocuments. Any parameters the user enters to tell copy.bat what to copy should come after the filename.

Why not use VBs built in copy function. Its a lot faster and far more elegant than using a batch file.

Stuart


Report Offensive Follow Up For Removal

Response Number 2
Name: questioned
Date: May 29, 2008 at 18:26:36 Pacific
Subject: Easy VB Quetion
Reply: (edit)

I tried, but i decided to make a batch file named Copy.bat which holds the commands like copy this that, but now i just need to run it, so the copy.bat is located in Directory.Text
now i need to run the batch file from Directory.Text.

For the VB copy function, i tried, but failed.. iunno whats wrong with it

Noobs R ME


Report Offensive Follow Up For Removal

Response Number 3
Name: klint
Date: May 30, 2008 at 03:28:29 Pacific
Subject: Easy VB Quetion
Reply: (edit)

Have you tried using "\copy.bat" instead of "/copy.bat"?


Report Offensive Follow Up For Removal

Response Number 4
Name: klint
Date: May 30, 2008 at 03:41:41 Pacific
Subject: Easy VB Quetion
Reply: (edit)

By the way, I noticed you mentioned "VB Script", but the code you've shown us seems to be Visual Basic 6 syntax. Can you clarify what language you are referring to?

If it's VBScript (i.e. a .vbs file) then that doesn't have a Shell function, instead you have to create a WScript.Shell object.


Report Offensive Follow Up For Removal

Response Number 5
Name: questioned
Date: May 30, 2008 at 18:05:57 Pacific
Subject: Easy VB Quetion
Reply: (edit)

...ok im sorry i was referring to Visual Basic, as in the script in VB6, not Visual Basic Script. Thank you for all your help... i was right all along, the /copy mixed with \copy was the problem.... which took out 7 hours of my time. Thanks

M

Noobs R ME


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Easy VB Quetion

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software