I have rtried the 'Shell' command and that does not work. Can not find any help in 'Books Online'.
7 Replies - 1204 Views - Last Post: 09 August 2012 - 12:08 AM
#1
I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
Posted 06 August 2012 - 10:05 AM
Replies To: I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
#2
Re: I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
Posted 06 August 2012 - 02:33 PM
Well, CopyFile isn't a DOS command. Maybe that's the real reason Shell doesn't work? Try using Copy or Xcopy instead. Feel free to post your code so we can have a better idea of where you're going wrong.
#3
Re: I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
Posted 06 August 2012 - 02:45 PM
Can I ask why do you want to use command line stuff? Doesn't VB have its own file functions? If you are not happy with them, you could always use the File Functions from the Windows API, which are as powerful as you need them to be.
DOS is dead, let it rest in piece!
DOS is dead, let it rest in piece!
#4
Re: I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
Posted 07 August 2012 - 12:33 PM
DOS is alive and well so long as I am. How the hell else would I execute a batch file?
This post has been edited by BobRodes: 07 August 2012 - 12:34 PM
#5
Re: I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
Posted 07 August 2012 - 04:02 PM
GunnerInc, on 06 August 2012 - 02:45 PM, said:
Can I ask why do you want to use command line stuff? Doesn't VB have its own file functions? If you are not happy with them, you could always use the File Functions from the Windows API, which are as powerful as you need them to be.
DOS is dead, let it rest in piece!
DOS is dead, let it rest in piece!
as being new to VB, I am unaware how touse thw windows API. Any help would be most appreciated!!
I want to use a command button to copy a file to an external drive. as I am new to VB, I do not know how to use the Windows API. Any help will be appreciated.
#6
Re: I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
Posted 07 August 2012 - 11:41 PM
Rather than using API's, have a look at the FileSystemObject, which will give you all you need to copy files.
You will need to add a reference to Microsoft Scripting Runtime.
Take a look at this link for further information.
You will need to add a reference to Microsoft Scripting Runtime.
Take a look at this link for further information.
#7
Re: I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
Posted 08 August 2012 - 07:25 PM
maj3091, on 07 August 2012 - 11:41 PM, said:
Rather than using API's, have a look at the FileSystemObject, which will give you all you need to copy files.
You will need to add a reference to Microsoft Scripting Runtime.
Take a look at this link for further information.
You will need to add a reference to Microsoft Scripting Runtime.
Take a look at this link for further information.
Thaks a bunch, worked the first time!! i will be comming back for more info as I am just a beginner in VB (spent 20 years doing RPG on AS/400)
#8
Re: I am new to VB. How do I execute a DOS command (i.e Copyfile) from VB?
Posted 09 August 2012 - 12:08 AM
No problem, glad to have helped.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|