Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Copy Command


I use batch files to copy files and folders from one location to another. Can you use the copy command in Visual Basic?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Run DOS Copy Command ?
Hi,

I want to run the DOS Copy command to backup my Database file. How to do so?

I used:

myApp = Shell(App.Path & "copy abacc1.mdb abbak.mdb")

But it is giving error. How to proceed ?

Copy Command?
is there some way that i can make a variable out of copied text?

EX. If I were to highlight ---THIS--- and then selected an option on a menu, could i make ---THIS--- a string? That would help! Thank You!

Sam

Copy DOS COmmand In VB
I need write the Dos command: "Copy fileA fileB " through a shell in VB6,
Thanks in advance

Copy Command In VB
I need write the dos command : "Copy filea fileb" trhough a shell in VB6, what uis the way ??
Thanks in advance

Copy Command
Hi, have a nice day.

i have a problem when copy folder

my problem is i need to copy some folders from D drive to C drive.. the folders have different name and theirs sub folders all have a log folder..
i wish to copy the folders without copy the log folder...
eg..
D:folderAAAA
D:folderABBB
D:folderACCC
D:folderAlog
D:folderAJJJ
D:folderAKKK

how could i just use the copy command just to copy the d:folderA and it'll copy all its sub folder except the sub folder log?
help is appreaciate.




Edited by - tiau on 8/30/2007 5:55:54 AM

DOS Copy Command
Hi kind people. I was wondering if there was anyway to copy a read-only file without the read-only attribute being cleared. I am running XP and am trying to accomplish this from a batch file. ie copy c:diranyfile.dat (read-only file) c:subdir. When I check the c:subdiranyfile.dat it is no longer read-only. I can always use the attrib +R command, but it would be a lot easier if I could just copy the file over as read-only. Am I missing something?

Thank you,

DAVE

Copy Command
Hello,

This is not a VB question, but it's used in a VB project. The "copy" command in DOS, how many files is it able to concatenate into one file? I have 13 files with .ps format that I want to concatenate into one .ps file. Is there some other DOS function that can do the same?

Grateful for help!

Copy Command
I am looking for a copy command. I want to take all the documents in a specific file and copy them to a different drive.
For example i want to copy all of my .doc files from C: and send them to D:
I know there has to be some sort of simple copy command but i can't come up with it.

Thanks
JM

DOS Copy Command
Is there a way to execute a DOS command from a Visual Basic program? I want to copy something from one location to another via Visual Basic.

Copy-Paste Command
What VB code should I use to get a program to copy a file and paste the copy in a certain location?

In really bad pseudocode, I'm guessing it would be:

Copy <filename> To Clipboard
Paste <filename> To <location>

I know what I've put here is probably wrong, but my experience with VB in terms of both internal and external clipboard functions is hovering just above 0 - in other words, I know that a clipboad function exists...

Thanks.

Which Is The Vb6 Command Copy To %systemroot%
well i want to use a vb6 command to copy a file from c: directory
to %systemroot% variable for example filecopy "c:something.mdb" , "%systemroot% empsomething.mdb" but it doesnt work!!! can anybody tell me how to do that??? thanks anyway!

Dos Shelling (Copy Command)
I have seen some reference to Dos Shelling and was wondering how this works.

Currently the program sends hex values to the printerport and the circut board recieves these values and the program is written in dos.

I think I can do the same thing in VB using shelling but how would I begin to do this?

Thanks

Invoking A COPY Command ( DOS )
Could someone answer me if the following sequence of code is correct to invoke a COPY command ( DOS ) :

***********
Function mapping()

Dim RetVal, strQuote, strCommand

strQuote = Chr$(34)
strCommand = "COPY " & strQuote & "C:Documents and SettingsDirectory_1file.txt" & strQuote & " C:Documents and SettingsDirectory_2"
RetVal = Shell(strCommand, 1)

End Function
************

Thank´s

Use Copy-paste Command
Hi.

How can I do for use copy & paste command for a grid, dbgrid and flexgrid to a office application using a clipboard command.

Any answer let me know.

Thanks a lot.

File Copy Command
Hi,

Another question. Will the file copy command work with universal file names???

Need VB Code For A Copy Command
Im looking to create some code in VB that i need to take a file from a main folder and have it automatically copy this file into all subsequent folders. any ideas?

a simple little program for this would be great.

Regarding API Copy Command (urgent)
hi.. here is something not related to programming code..
but i wish to know if i use the API's copy command to copy a file (>500MB) from computer A to computer B (where the program is running in computer B) will it affect the pc performance of the computer A?? any other impact on the computer A??

computer A and b are connected through LAN.

Thanks



Edited by - wtkm on 10/1/2007 7:33:45 PM

Creating Copy Command
Hi experts.

I want to write some codes on a command button.

When I click on this command button, any file or a folder on a machine should be copied on another machine.

the source and destination for the files/folder can be static or dynamic.




I am waiting.




Shiv

SQL Copy Record Command?
I need to copy an Oracle record from one table to another. The schema of both tables is identical.

The application uses OO4O functions, Orasession and Oradatabase objects. The data read is contained in a dynaset:

Dim OraSession, Oradatabase, dynLog As Object

Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set Oradatabase = OraSession.dbopendatabase(DBName, ConnStr, 0&)

An SQL SELECT statement is used to read the record:

Set dynLog = Oradatabase.dbcreatedynaset(strSql, 0&)

Is there any way to copy this record (contained in dynLog) to another table without having to construct an explicit SQL string for an INSERT command? I'm trying to save myself a great deal of work if possible.

Thanks

Using DOS Copy Command Within A Shell
Hello,
I am having a devil of a time with this problem.
At my network here at work, if I start my DOS prompt and type the following:
copy C:labelsmyfile.txt \seanhp

HP is my printer on my computer and the file prints fine. So I want to add that functionality to a labelmaker that I wrote, but if I try to use the Shell like this:


Shell "copy c:labelsmyfile.txt \seanhp"




I have also tried :

Shell "Command.com /c copy c:labelsmyfile.txt \seanhp"




and this:

Shell "c:labelscopy myfile.txt \seanhp"




I get the file not found error message, though the file is certainly there.

Any way around this???

Thanks,
Sean

Userform Command Button Copy
I have the following code: The problem is there are blanks included in the range K3:K5900. How do I code it so when the command button is clicked that only cells with a value are copied. These values are email addresses and will eventually be pasted into a different email program. I just want it to copy to the clipboard the cells with values. All it is doing now is copying the range which is what i told it to do, but I would like it to look for just values.

Private Sub cmdaoc_Click()
ActiveWorkbook.Sheets("Sheet1").Activate
Range("K3:K5900").Copy

MsgBox "You have successfully copied all AOC Ops Consultants to your clipboard. Please open Lotus Notes and paste the addresses in the (TO field. Thank You", vbOKOnly, "Successful Copy"
End Sub

Which Command Copy File That Browsed ?
if i browsed some image file with common dialod then i click ok and how to copy it to my destination folder ?

Help: How Do You Make A Command Button Copy?
-=Help=-

How do you make a command button copy a textbox to your computer's clipboard?

How To Create Command Copy Cut And Paste ?
there was command ? or must create function by myself ??

A Simple File Copy Command?
Ok, im making a simple background shuffler in VB4.

I just need a simple command to copy a file (strSelection) to another place(strNewplace), replacing the old one, if it exists.

the files will be large sized bitmaps, if that matters any.



Thanks in advance!

Copy Command Prompt Contents
I've got an old database for DOS that I want to extract some information from, but there's no way to customise reports how I want. To cut a long story short, I'm hoping to send key presses to it from a VB program (this bit shouldn't be a problem), and then copy the results from the screen.

eg. If I open a command prompt (not full screen), load the database and get some information up, I can then click on the system menu and select Edit / Select All / Copy and then Paste this information elsewhere.

What I really want to do is automate this - copy it to the clipboard from my VB program and paste it into an array.

Does anyone have any idea how to do such a thing?
Any guidance would be MUCH appreciated.

Cheers,
Dan.

Detect Copy/delete Command
Hi all,

I am trying to write a program run on my PC in the background. When ever I copy or delete a file/folder it will log the file/folder name, date, time, and copy/delete command into the database.

what api can I use to detect copy/delete command

Thx

Is There Vb Command Similar To Foxpro's Copy To
Ive created a program in vb that reads out text files and extracts information, filters it and throws them to an excel file. It works but text files I need to process can reach to 50 thousand lines. and data thrown to excel can be 20 thousand rows. Processing thus takes at least 10 minutes.

I wonder now if there is a command in vb6 that is similar to foxpro's copy to that will make my program work faster?

Copy From Listbox2 To Listbox1 With Command Button
I am trying to copy (or move) from listbox2 to listbox1, using simple multiselct, with a command button.

I want the command button to also remove the selected items in listbox2 after the selected items have already been copied to listbox1.

I got the copying part down, and it works. It's the list2.removeitem portion that is screwing me up. I can't figure out where and what to add exactly the list2.removeitem.
I left out the list2.removeitem in the code below.

Here is the code.

Any ideas?


Private Sub cmdmr_Click()
On Error Resume Next
Dim i As Integer
For i = 0 To List2.ListCount - 1
If List2.Selected(i) Then
List1.AddItem List2.List(i)
End If
Next i

End Sub

COPY AND RENAME When I Press A Command Button
I want to know how can I have a commandbutton1, so when I press
it that COPIES a specific file (lets say TEST.MDB) from the application
path to a network computer (lets say to the USER5CBACKUPS folder
which of course it is shared and i have permissions to write etc.

Another similar situation is instead of copying using commandbutton1 but commandbutton2 to RENAME
the TEST.MDB mentioned above to lets say NEWTEST.MDB

I suppose this is kind SHELL command but I am not familiar with it because
I guess you run only a EXE file and not a total of DOS commands

Thanx a lot for your time

File Copy Program Using Open Command - Please Help Me
File copy program using Open command - Please help me


I need to do the following . If you can, please do the details.

1) Open a file (at any type as binary mode like open s for binary access read as #file)

2) Then read one line or one character (line is good) from the file

3) open another blank file for write

4) write the readed data from the first file

5) continue the process till the last file and first file as the same.

------

This is my project to do, please help me to do the above. I know the file pointer and details about file reading commands in C++, But I suffer lack of knowledge about the same in VB. Please help me with the details or reffer any good sites with the details in File programming in VB.

Thanking you in advance

Feby

Copy, Rename And Open A File Through Command Button
hey all!
i need help plz!
i have an access file .mdb
i need a command button code that copies, renames and open dat mdb file.
the user should enter the name of the new file through a textbox on the form.
can anybody help plz!

How To "trigger" The Error And Write It To The Textbox [regarding Copy Command) (Help)
Code:Option Explicit
Public Type SHFILEOPSTRUCT
    hWnd As Long
    wFunc As Long
    pFrom As String
    pTo As String
    fFlags As Integer
    fAnyOperationsAborted As Long
    hNameMappings As Long
    lpszProgressTitle As Long ' only used if FOF_SIMPLEPROGRESS, sets dialog title
End Type
Public Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
' Available Operations
Public Const FO_COPY = &H2 ' Copy File/Folder
Public Const FO_DELETE = &H3 ' Delete File/Folder
Public Const FO_MOVE = &H1 ' Move File/Folder
Public Const FO_RENAME = &H4 ' Rename File/Folder
' Flags
Public Const FOF_ALLOWUNDO = &H40 ' Allow to undo rename, delete ie sends to recycle bin
Public Const FOF_FILESONLY = &H80 ' Only allow files
Public Const FOF_NOCONFIRMATION = &H10 ' No File Delete or Overwrite Confirmation Dialog
Public Const FOF_SILENT = &H4 ' No copy/move dialog
Public Const FOF_SIMPLEPROGRESS = &H100 ' Does not display file names

Dim abc As Boolean

Public Sub VBCopyFolder(ByRef strSource As String, ByRef strTarget As String)

    Dim op As SHFILEOPSTRUCT
    With op
        .wFunc = FO_COPY ' Set function
        .pTo = strTarget ' Set new path
        .pFrom = strSource ' Set current path
        .fFlags = FOF_NOCONFIRMATION + FOF_SILENT
    End With
    ' Perform operation
    
    SHFileOperation op

End Sub

Private Sub Command1_Click()


Call VBCopyFolder("DONT_HAVE_THIS_FOLDER", "d: esting1")

End Sub




From above API, i purposely Call VBCopyFolder("D:DONT_HAVE_THIS_FOLDER", "d: esting1")
where D:DONT_HAVE_THIS_FOLDER is invalid path.. the VBCopyFolder function will not give me the error in message dialog box as i set the .fFlags = FOF_NOCONFIRMATION + FOF_SILENT. My question is i still want the .flags command (as it does not give me dialog message) but i would like to write the error to the textbox (so whenever i have tme i can see the error log from the text box"




Edited by - wtkm on 8/16/2007 6:08:47 PM

Cannot Copy Using Sendkeys "^C" Command???
hi everyone,

thanx guys for helping me and guiding me. now i really comfortable with what i`m doing. thanx a lot.

I have a little problem. that is I can not copy a window to a clipboard. I mean what I want is after I copy a window in to a clipboard I want to close that window. well thanx to u guys I can do that everthing . But if I use "sendkeys" and "postmessage" functions at the same time I can not copy that window to the clipboard. but if I comment the "postmessage" function and use only the "sendkeys" function it works fine. I think the reason is I closing the window too fast. Just to get the idea of what i`m doing, I post u the coding,


code
--------

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long

Const WM_CLOSE = &H10

Dim WinWnd As Long
Dim Ret As String
Dim RetVal As Long
Dim lpClassName As String
Dim lHandle As Long

Private Sub Timer1_Timer()
' classname=#32770
Ret = "Messenger Service "
WinWnd = FindWindow(vbNullString, Ret)
'If WinWnd <> 0 Then
If WinWnd = 0 Then Exit Sub

'Set this window to the foreground
lHandle = SetForegroundWindow(WinWnd)

SendKeys "^C"

PostMessage WinWnd, WM_CLOSE, 0&, 0&
End Sub


so how can I do this.???? and is there ia a way to get the copyed data from clipboard to a string????

Some how i want to copy the message as well as close the window. how do i use thies both functions together.

hope u undestand my question and if not please feel free to ask any questions.


thanx in advance.

regards,
Niroshan

How Can I Select/copy Info From 1 Listbox,make It Copy To Another Thenexportto Ssheet
Hi all,
Get a pretty simle one but a little bit too difficult for me to work out.

I've attached a file to this thread called ListBox.zip.

It basically contains a form with listboxes (FromList & ToList).
I've added some names in the listbox by using the following code

FromList.AddItem ("Dog")

etc etc.


The word Dog appears in the list box as normal.

I would like to be able to click on the word dog in the ListBox, then click a Command Button (named cmdMoveListItems)
and it simply transfers the word dog across to the other ListBox.

Also, would like to click on another Command Button which openeds up a spreadsheet preferred (or another page with a single list box in it) and displays what I selected.

Any help would be greatly appreciated.

Thanks...

Creating Copy Source Code To Copy Auto To Windows Clipboard
Created a program that receive a weight from scale count with active x now i need it in a field in another app any code or suggestions will
be appreciated greatly
i have a couple ideas
e.g.placing them to keyboard buffer
e.g.creating a copy source code to auto copy data
then to paste it in the other app.
Thanks

Copy 2 Pics With Bitblt In Picture1 -&gt; OK -&gt; BUT: How Can I Copy Picure1 To Picture2
Hi !

Copy 2 Pics with Bitblt in Picture1 -> OK This works fine !

BUT:

How can I copy Picure1 to Picture2 ?

I know that Picture2.Picture = Pictrue1.Pictrue will never work because of Bitblt. But how can I copy Picture1 to Picture2 that "Picture3.Picture = Pictrue2.Pictrue" would work ?

Thx 8)



/Edit: Short explain: I want to save the Picture1 created by Bitbld in an ImageList1... *g*

Copy Files With VB6 Using The File Copy Dialog Box Of Windows 98
I want to use the file copy dialog box of Windows 98 to copy files using a VB6 program.
How can I do that?

My best regards

José Nogueira

Outlook (copy And Blind-copy) Recipients
How can I add copy and blind-copy to other recipients ?
I have today the following code for send a mail.



Dim myOutlook As Object
Dim myMailItem As Object

Set myOutlook = CreateObject("Outlook.Application")
Set myMailItem = myOutlook.CreateItem(0)
myMailItem.Recipients.Add "aaaa@bbbb@company.com"

myMailItem.Subject = "test subject"
myMailItem.Body = "test body"
myMailItem.Send
Set myOutlook = Nothing
End Sub

Copy Paste / Copy To Cilp Board..
Is it possible to Copy and paste to a Picture Box?
---OR---
Copy from a picture box to Clipboard. Or even save as a pcx or jpg/gif file?...

Thanks...

Copy And Copy In Outlook, Quite Simple...
Hi,
this seems to be the first forum where people actually get replies. I'm sure mine is quite simple to solve, but I've been struggling...

I'm trying to get a Macro in Outlook to Copy the header and body of an e-mail at once - into the clipboard- (outlook itself doesn't allow this using the usual "copy-paste" method, header and body have to be copied and pasted separately). That's basically all!

I am an absolut novice at VB (u can probably tell), but I need that Macro to work asap, I really appreciate any help.

Thanks,

Paul.

Project Properties, Make/Command Line Args Vs Command
When setting the Project's Properties, on the Make tab, in the Command Line Args area, if I put a file's PathName and run it, there are no quotes Chr(34) around it. When I run the app from the IDE it works and copies/moves my file. When I pass a file's PathName via drag/drop, command line or Send To menu, I get quotes and the copy/move fails.

I've parsed the Chr(34)'s out of the strings, but am curious if this will affect other OS's in different ways? I'm developing it on XP, and will be running it on an ME and a 98SE machine as well.

Any thoughts?

TYIA

'Rekd

Make All Command Boxes Have A Change Command
I need some help trying to figure out how to make all my comboboxes have a Change command without having all the boxes in an array.

Is this possible?

Thanks,
David

Parend Command & Child Command (DataEnvironment)
How can i have reference to a child Comand in my code???
fror example to ... .Movelast or to .Delete

Plz Help

Changing The Command Text Of A Command That Has Been Grouped
Hi, I am a newbie to all of this and was wondering if someone could help me with a problem I am having. I am trying to dynamically change the command text for a data environment command that has been grouped. For some reason what I have tried does not work. Here is what I have tried:

I have a data environment with a command called command1 that is grouped. The grouped name is command1_grouped. The grouped command has the following fields: Summary fields has MealName. Detail Fields has MealName and IngrediantName.

I have created a data report that is grouped by the meal name and then lists the ingrediants for that meal. This works fine. However, I would like the user to be able to imput a list of meals and then get a print out. This requires me to build the command text dynamically. But when I try the following I get errors.

DataEnvironment1.Commands("Command1_Grouping").CommandText = (NEW SQL STATEMENT GOES HERE).

DataEnvironment1.Connection1.Execute DataEnvironment1.Commands("Command1_Grouping").CommandText


When I run this I get an error telling me that Command1.IngrediantName cannot be found(this occurs when I try to open the data report). If I ungroup the command and then change the command name back to its original name it works fine, except I can no longer use the group heading in my data report. I.E. DataEnvironment1.Commands("Command1").CommandText = (NEW SQL STATEMENT GOES HERE).

It wont let me use the original command name if it is grouped. In other words if I tried the code above while the command was still grouped I get an invalid procedure or argument error.

As you can probably tell I am at a complete loss here and would really appreciate anyones help

Thanks,
scarlet13

Using A Command Button To Click Other Command Buttons? Please Help
Hi
I am creating a program and I want to make it so if I click one command button VB automatically click other command buttons

i.e.
Clicking command 4 runs
command 1
command 2
command 3
in that order

Please help

Thanks

Running A DOS Command WITHOUT The Command Window Appearing
Hi,

I want to run a DOS command from my Visual Basic program - and I can do that fine, but I want to do it without the Command Window popping up. Is there a way to do this?? because if the command window pops up it makes my app look very scruffy.

Robin

Shell Command, Command Line Parameter
hi,
i'm a VB newbie...

I'm attempting to make a file/folder selector to play winamp compatible files in (its my Software Design Major ) - the trouble is with the command line interpretation of the code. For those who don't know, items can be played in winamp like so:

C:path owinampwinamp.exe /ADD C:mp3whatever.mp3
(Adds C:mp3whatever.mp3 to the playlist of a running Winamp, if Winamp is running, otherwise it opens Winamp and plays it outright)

this also works with a folder specified at the end of the winamp location aswell rather than a file

heres what i'm trying
this is onclick


VB Code:
fileselected = filemodelist.SelectedText1.Text = fileselectedopendir = "C:Program FilesWinampWinamp.exe " + fileselected + "" Text1.Text = opendirShell opendir


this just opens winamp with a messed up playlist where every part of the location with a space between it is a new item in the playlist

e.g.
1. Alice
2. Deejay
3. -
4. Who
5. Needs
6. Guitars
7.

there must be a relatively easy way to do this...

WuZ.

Sending Command To Command Prompt To Be Execute
how can i send a dos command from vb program to command prompt to be execute? thanx

Copyright © 2005-08 www.BigResource.com, All rights reserved