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...
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.
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
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.
...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