I have a batch file I got from somewhere that runs a backup. The file
contains the following lines:

copy "c:\documents and settings\administrator\local settings\application
data\microsoft\windows nt\ntbackup\data\*.log" "c:\backup\backlog.txt"

del "c:\documents and settings\administrator\local settings\application
data\microsoft\windows nt\ntbackup\data\*.log"

As you probably know, when ntbackup creates a report, it increments the
name. Since the last line of the code deletes all files with the .log
extension, when the batch runs again, the only log file in the folder is the
one for that backup job. That said, how is it possible that it can copy the
file using the wildcard and save it as backuplog.txt?

What I am trying to do is do this within a vbscript. I cant seem to do it
using CopyFile, so I tried to do it via a WScript.shell leaving me with the
following command:

Return = shell.Run ("copy ""c:\documents and settings\administrator\local
settings\application data\microsoft\windows nt\ntbackup\data\*.log""
c:\backup\backlog.txt""")

This code does not work. It keeps telling me that it cannot find the file
specified. Is this because the syntax of my quotation marks is wrong. When I
run the command from the command line, it works, just not from the script.If
I cannot make the line work, is there any way I can CopyFile to make it
work?

I appreciate the help.

Chris

Re: Copying Files (Wierd one) by Torgeir

Torgeir
Wed Dec 03 14:05:31 CST 2003

Chris Guimbellot wrote:

> What I am trying to do is do this within a vbscript. I cant seem to do it
> using CopyFile, so I tried to do it via a WScript.shell leaving me with the
> following command:
>
> Return = shell.Run ("copy ""c:\documents and settings\administrator\local
> settings\application data\microsoft\windows nt\ntbackup\data\*.log""
> c:\backup\backlog.txt""")
>
> This code does not work. It keeps telling me that it cannot find the file
> specified. Is this because the syntax of my quotation marks is wrong.

Hi

copy is a builtin command to cmd.exe and not a separate executable, so you need
to wrap it into a call to cmd.exe. This should work better:

Return = shell.Run ("%comspec% /C copy ""c:\documents and ...

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: Copying Files (Wierd one) by Chris

Chris
Wed Dec 03 16:08:44 CST 2003

That worked like a champ. Thanks a lot. Not that it really matters, but
there is no way to do that native to vbscript, is there? Thanks,

Chris
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3FCE420B.C85CDD83@hydro.com...
> Chris Guimbellot wrote:
>
> > What I am trying to do is do this within a vbscript. I cant seem to do
it
> > using CopyFile, so I tried to do it via a WScript.shell leaving me with
the
> > following command:
> >
> > Return = shell.Run ("copy ""c:\documents and
settings\administrator\local
> > settings\application data\microsoft\windows nt\ntbackup\data\*.log""
> > c:\backup\backlog.txt""")
> >
> > This code does not work. It keeps telling me that it cannot find the
file
> > specified. Is this because the syntax of my quotation marks is wrong.
>
> Hi
>
> copy is a builtin command to cmd.exe and not a separate executable, so you
need
> to wrap it into a call to cmd.exe. This should work better:
>
> Return = shell.Run ("%comspec% /C copy ""c:\documents and ...
>
> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>
>



Re: Copying Files (Wierd one) by Joe

Joe
Wed Dec 03 17:24:05 CST 2003

Hi,

"Chris Guimbellot" <cguimbellot@FORGETSPAM.hifranchise.com> wrote in message
news:#ig4KoeuDHA.2448@TK2MSFTNGP12.phx.gbl...
| That worked like a champ. Thanks a lot. Not that it really matters, but
| there is no way to do that native to vbscript, is there? Thanks,

CopyFile should have worked, unless there's a permissions issue with the
file or the destination file overwrite is read-only. Probably a syntax
issue. Post back the code lines that you attempted to use re CopyFile and
the error that you received, and someone can help.

Joe Earnest



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 09-23-03



Re: Copying Files (Wierd one) by Chris

Chris
Wed Dec 03 17:33:52 CST 2003

Joe,

Here is what I used:

Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile "c:\documents and settings\administrator\local
settings\application data\microsoft\windows nt\ntbackup\data\*.log",
"c:\backup\backlog.txt"

Here is what the error said:

backupjob.vbs (108,1) Microsoft VBScript Runtime Error: Path not found

A few things to mention. First, line 108 is where the fs.CopyFile statement
is. Second, the file was not copied (this one is pretty evident since I'm
still having the problem). Third, the paths in the fs.CopyFile statement are
correct.

The following line, on the other hand, works:

oShell.Run ("%comspec% /C copy ""c:\documents and
settings\administrator\local settings\application data\microsoft\windows
nt\ntbackup\data\*.log"" c:\backup\backlog.txt""")

Any ideas on that? Thanks,

Chris

"Joe Earnest" <joeearnestNO@SPAMqwest.netPLEASE> wrote in message
news:%23Bq3UPfuDHA.2432@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> "Chris Guimbellot" <cguimbellot@FORGETSPAM.hifranchise.com> wrote in
message
> news:#ig4KoeuDHA.2448@TK2MSFTNGP12.phx.gbl...
> | That worked like a champ. Thanks a lot. Not that it really matters, but
> | there is no way to do that native to vbscript, is there? Thanks,
>
> CopyFile should have worked, unless there's a permissions issue with the
> file or the destination file overwrite is read-only. Probably a syntax
> issue. Post back the code lines that you attempted to use re CopyFile and
> the error that you received, and someone can help.
>
> Joe Earnest
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.521 / Virus Database: 319 - Release Date: 09-23-03
>
>



Re: Copying Files (Wierd one) by Joe

Joe
Wed Dec 03 18:00:02 CST 2003

Hi Chris,

"Chris Guimbellot" <cguimbellot@FORGETSPAM.hifranchise.com> wrote in message
news:#E3xvXfuDHA.2260@TK2MSFTNGP09.phx.gbl...
| Joe,
|
| Here is what I used:
|
| Set fs = CreateObject("Scripting.FileSystemObject")
| fs.CopyFile "c:\documents and settings\administrator\local
| settings\application data\microsoft\windows nt\ntbackup\data\*.log",
| "c:\backup\backlog.txt"
|
| Here is what the error said:
|
| backupjob.vbs (108,1) Microsoft VBScript Runtime Error: Path not found
|
| A few things to mention. First, line 108 is where the fs.CopyFile
statement
| is. Second, the file was not copied (this one is pretty evident since I'm
| still having the problem). Third, the paths in the fs.CopyFile statement
are
| correct.
|
| The following line, on the other hand, works:
|
| oShell.Run ("%comspec% /C copy ""c:\documents and
| settings\administrator\local settings\application data\microsoft\windows
| nt\ntbackup\data\*.log"" c:\backup\backlog.txt""")
|
| Any ideas on that? Thanks,

My fault in not reading your original posts closely enough.

You can't concatenate the contents of multiple files to a single file with