Prev: Launching defrag from script
Next: Domain Logonserver
From: PAkerly on 5 Jan 2010 12:51 Hello, Right now I am doing something like this to FTP get some files. Set objShell = CreateObject("WScript.Shell") objShell.Run "c:\windows\system32\ftp.exe -s:getfilest.txt", , True Set objShell = Nothing and the getfiles.txt file looks like this: open 10.10.100.1 user psw lcd c:\myfiles cd /my/linux/dir mget qew*.txt mget exa*.txt mget file*.txt quit But I want to modify my code to have a variable, ie: dates and a user will enter 01 to 12 so really what I will want to find is: so a file might be called: qew123109.txt and I want to grab any qew12 files or whatever was entered in the variable dates. so can I do this: Set objShell = CreateObject("WScript.Shell") objShell.Run "c:\windows\system32\ftp.exe -s:getfilest.txt", , True Set objShell = Nothing BUT not use the getfiles.txt file and just write line by line what I am looking to do within the VBScript? ie: mget "qew" & dates&*.txt ?
From: Pegasus [MVP] on 5 Jan 2010 13:50 "PAkerly" <pakerly(a)gmail.com> said this in news item news:fce4fb1a-7d37-44a5-a40f-c9926456c6fa(a)g18g2000vbr.googlegroups.com... > Hello, > Right now I am doing something like this to FTP get some files. > > Set objShell = CreateObject("WScript.Shell") > objShell.Run "c:\windows\system32\ftp.exe -s:getfilest.txt", , True > Set objShell = Nothing > > and the getfiles.txt file looks like this: > > open 10.10.100.1 > user > psw > lcd c:\myfiles > cd /my/linux/dir > mget qew*.txt > mget exa*.txt > mget file*.txt > quit > > But I want to modify my code to have a variable, ie: dates and a user > will enter 01 to 12 so really what I will want to find is: > > so a file might be called: qew123109.txt and I want to grab any qew12 > files or whatever was entered in the variable dates. > > so can I do this: > > Set objShell = CreateObject("WScript.Shell") > objShell.Run "c:\windows\system32\ftp.exe -s:getfilest.txt", , True > Set objShell = Nothing > > BUT not use the getfiles.txt file and just write line by line what I > am looking to do within the VBScript? > > ie: mget "qew" & dates&*.txt > ? Since ftp.exe requires its parameters to be embedded in a script file (getfilest.txt in your case), you must write your date variable into that script file. If this is not acceptable then you would need to look for a different ftp utility.
From: PAkerly on 5 Jan 2010 14:05 On Jan 5, 1:50 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > "PAkerly" <pake...(a)gmail.com> said this in news itemnews:fce4fb1a-7d37-44a5-a40f-c9926456c6fa(a)g18g2000vbr.googlegroups.com... > > > > > Hello, > > Right now I am doing something like this to FTP get some files. > > > Set objShell = CreateObject("WScript.Shell") > > objShell.Run "c:\windows\system32\ftp.exe -s:getfilest.txt", , True > > Set objShell = Nothing > > > and the getfiles.txt file looks like this: > > > open 10.10.100.1 > > user > > psw > > lcd c:\myfiles > > cd /my/linux/dir > > mget qew*.txt > > mget exa*.txt > > mget file*.txt > > quit > > > But I want to modify my code to have a variable, ie: dates and a user > > will enter 01 to 12 so really what I will want to find is: > > > so a file might be called: qew123109.txt and I want to grab any qew12 > > files or whatever was entered in the variable dates. > > > so can I do this: > > > Set objShell = CreateObject("WScript.Shell") > > objShell.Run "c:\windows\system32\ftp.exe -s:getfilest.txt", , True > > Set objShell = Nothing > > > BUT not use the getfiles.txt file and just write line by line what I > > am looking to do within the VBScript? > > > ie: mget "qew" & dates&*.txt > > ? > > Since ftp.exe requires its parameters to be embedded in a script file > (getfilest.txt in your case), you must write your date variable into that > script file. If this is not acceptable then you would need to look for a > different ftp utility. Is it possible to get the dates variable into that file?...and for ftp.exe to use it? I tried: mget "qew" & dates&*.txt and it did not work. It was actually looking for "qew" & dates&*.txt instead of qew12*.txt
From: Pegasus [MVP] on 5 Jan 2010 14:25 "PAkerly" <pakerly(a)gmail.com> said this in news item news:fa6784b3-159e-405d-afbe-fabc530dfaa4(a)33g2000vbe.googlegroups.com... > On Jan 5, 1:50 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: >> "PAkerly" <pake...(a)gmail.com> said this in news >> itemnews:fce4fb1a-7d37-44a5-a40f-c9926456c6fa(a)g18g2000vbr.googlegroups.com... >> >> >> >> > Hello, >> > Right now I am doing something like this to FTP get some files. >> >> > Set objShell = CreateObject("WScript.Shell") >> > objShell.Run "c:\windows\system32\ftp.exe -s:getfilest.txt", , True >> > Set objShell = Nothing >> >> > and the getfiles.txt file looks like this: >> >> > open 10.10.100.1 >> > user >> > psw >> > lcd c:\myfiles >> > cd /my/linux/dir >> > mget qew*.txt >> > mget exa*.txt >> > mget file*.txt >> > quit >> >> > But I want to modify my code to have a variable, ie: dates and a user >> > will enter 01 to 12 so really what I will want to find is: >> >> > so a file might be called: qew123109.txt and I want to grab any qew12 >> > files or whatever was entered in the variable dates. >> >> > so can I do this: >> >> > Set objShell = CreateObject("WScript.Shell") >> > objShell.Run "c:\windows\system32\ftp.exe -s:getfilest.txt", , True >> > Set objShell = Nothing >> >> > BUT not use the getfiles.txt file and just write line by line what I >> > am looking to do within the VBScript? >> >> > ie: mget "qew" & dates&*.txt >> > ? >> >> Since ftp.exe requires its parameters to be embedded in a script file >> (getfilest.txt in your case), you must write your date variable into that >> script file. If this is not acceptable then you would need to look for a >> different ftp utility. > > Is it possible to get the dates variable into that file?...and for > ftp.exe to use it? I tried: > mget "qew" & dates&*.txt > and it did not work. It was actually looking for "qew" & dates&*.txt > instead of qew12*.txt You would use the writeline method of the File System Object to generate getfiles.txt. If unsure about its syntax, have a look at the help file script56.chm which you can download from the Microsoft site. It includes detailed examples for all basic VB Script methods.
|
Pages: 1 Prev: Launching defrag from script Next: Domain Logonserver |