1.

Solve : Bat file to unzip a file?

Answer»

Hi,
I have tried to use this code but get the following error:

C:\Documents and Settings\A79678\Desktop\NewFolder\uz.vbs(9, 1) MICROSOFT VBScri
pt runtime error: Object required: 'objShell.NameSpace(...)'

Can anyone tell me what the (9, 1) means?

code for uz.vbs is:

Set WshShell = CreateObject("Wscript.Shell")
user = WshShell.ExpandEnvironmentStrings("%UserName%")


strZipFile = "image_043009.zip"         
outFolder = "NewFolder"
   
Set objShell = CreateObject( "Shell.Application" )
Set objSource = objShell.NameSpace(strZipFile).Items()
Set objTarget = objShell.NameSpace(outFolder)
intOptions = 256
objTarget.CopyHere objSource, intOptions





Any one can help me to unzip file through batch
File format is sauch...........
00_BAN_AP_DISC_20090526.txt.gzthe error is because you dont specify the fullpath-name for the fle.

alternative:
you can opt to use fso.getabsolutepathname() method
Code: [Select]set fso=createobject("scripting.filesystemobject")
strZipFile=fso.getabsolutepathname(strZipFile)Hi all,

I am running this SCRIPT and does not give any output also in test sheet, no comment generated (i.e TEST11.txt)..

ANY ONE HELP ME?


strZipFile = "E:\Batch\01_BAN_TN_ADJM_20090601.zip"         
outFolder = "E:\Batch\"

set fso=createobject("scripting.filesystemobject")
strZipFile=fso.getabsolutepathname(strZipFile)


Set addon_fso = CreateObject("Scripting.FileSystemObject")
Set addon_sftp = addon_fso.CreateTextFile("TEST11.txt")
   
Set objShell = CreateObject( "Shell.Application" )
Set objSource = objShell.NameSpace(strZipFile).Items()
Set objTarget = objShell.NameSpace(outFolder)
intOptions = 256
objTarget.CopyHere objSource, intOptions
what are you trying to ACHIEVE?

how to use CreateTextFile method, from wscript documentation:
Code: [Select]Sub CreateAfile
   Dim fso, MyFile
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)
   MyFile.WriteLine("This is a test.")
   MyFile.Close
End Sub



Discussion

No Comment Found