Hello Everybody,
I want to I want to perform dos command (copy) in vb.net.I want to do it on button click event.Invoking the command using .bat format is not suit for me, because the source and destination of copying depending upon the selection of source and destination(that's done by users of this application).Please help me.

8 Years
Discussion Span
Last Post by mirza.imran
Shell("cmd /c copy file1 file2", vbHide)

the cmd /c closes the command window as soon as the command is ran and vbhide hides the command window so its not seen.

Hope this helps.


probably doing an assignment for school and is directed to do it this way. (maybe a vbscript batch file for system admin?)


hello friends

Shell("cmd /c copy file1 file2", vbHide)

doesn't work.
I need to run the command

copy /b file1 + file2

how can I do this?


It doesn't works.Any way thanks for your reply.As I mentioned above I want to perform

copy /b file1 + file2 file3

Are File1 File2 and File3 supposed to be variables in your program, or are they hard-coded in names?


To run DOS command in VB.Net use following code. It might be useful for you.
Shell("cmd.exe /c c:\first.exe < in.txt > out.txt")


Edited by Nick Evan: Spam removed


Dim tre = "copy /b """ & txtFile1.Text & """" & txtFile2.Text & """
Shell(tre, vbHide)

bt if you want two files to be copied into one ?? you shuld look for the particualr command to that bt the syntax to call it in the vb.net code will be the same.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.