Re: How Can Execute this with WSH?




"Nelson Rodriguez" <neroig@xxxxxxxxxxxxx> wrote in message
news:46BA9565-D9A0-419F-B0B4-B7620830F0A7@xxxxxxxxxxxxxxxx
I have problemas with the blank between words RESPALDOS and NELSON.

Can someone help me please?
Thanks.


Set fso = CreateObject("Scripting.FileSystemObject")
set shell=createobject("Wscript.Shell")
cdirbkp="D:\CTM\*.*"

mes=month(date)
if month(date)<10 then
mes="0"&month(date)
end if
dia=day(date)
if day(date)<10 then
dia="0"&day(date)
end if

ctarget2="\\sg05\DSATA\Respaldos Nelson\CTM_"&year(date)&mes&dia & ".ZIP"

if fso.FileExists(ctarget) then
fso.DeleteFile(ctarget)
end if

xcmd_zip="C:\Archivos de Programa\winzip\winzip32.exe -min -a -r -p -ex "
& ctarget2 & " " & cdirbkp

Set oShell=shell.exec(xcmd_zip)
Do While oShell.Status = 0
WScript.Sleep 500
Loop


If the parameter passed to winzip32 has spaces it must be enclosed in
quotes. Any quotes in a quoted string must be doubled. Try:

ctarget2 = """\\sg05\DSATA\Respaldos Nelson\CTM_" & year(date) & mes & dia &
".ZIP"""

You can troubleshoot by echoing the value at command prompt. For example:

ctarget2 = """\\sg05\DSATA\Respaldos Nelson\CTM_" & year(date) & mes & dia &
".ZIP"""
Wscript.Echo ctarget2

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


.



Relevant Pages

  • Re: Deleting users from an OU
    ... Richard Mueller ... quotes, but I couldn't figure out how to 'say' add double quotes to the ... end of each line (in Notepad). ... objOU.Delete strClass, strUserCN ...
    (microsoft.public.scripting.vbscript)
  • Re: time and or day of week
    ... I think you want to take DateArrayout of the quotes. ... but the colons aren't valid in a file name. ... Set FSO = CreateObject ... Prev by Date: ...
    (microsoft.public.scripting.vbscript)

Loading