Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error when running Vbscript--error 80070002 1

Status
Not open for further replies.

anhduydb

Vendor
Dec 8, 2010
2
US
it's ok for me to run below script on win XP, but on win 7x64 occur below error

line: 25
char: 31
error: the system can not find the file specified
code: 80070002
source: (null)

any one can help?

script as below:

Dim WshShell, objXL, file
Dim currpath, filename, filexls, filebat

Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

currpath =
fso.GetFile(WScript.ScriptFullName).ParentFolder.ShortPath
filename = "PLFTP"
filexls = currpath & "\" & filename & ".XLS"
filebat = currpath & "\" & filename & ".BAT"
folderupload = currpath & "\UPLOAD"

if (not fso.FileExists(filexls)) then
msgbox "file <" & filename & ".XLS> is missing, FTP process
aborts"
else
if (not fso.FolderExists(folderupload)) then
msgbox "subfolder <UPLOAD> is missing, FTP process aborts"
else
set file = fso.GetFile(filexls)
select case file.attributes
case 0
case 32 Set objXL =
WScript.CreateObject("Excel.Application")
objXL.Workbooks.Open filexls
if (fso.FileExists(filebat)) then
WshShell.run "command /c " & filebat
end if
case 1 msgbox "file <" & filexls & "> is READONLY,
FTP process aborts"
case Else msgbox "file <" & filexls & "> is not in
normal status (" & _
file.attributes & "), FTP process
aborts"
end Select
end if
end if
 
Replace this:
WshShell.run "command /c " & filebat
with this:
WshShell.run "cmd /c " & filebat

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top