Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 687

[RESOLVED] VBScript errors with 'Access is Denied'

$
0
0
:wave:
We have a .net application in our project that is giving me problems on my machine. Part of the app calls various .vbs files to perform batch operations - zipping files and moving them around mostly. The code works on the original developer's machine, but it errors on mine - throwing up a message box. The msgbox title says "Compressed (zipped) Folders Error", while the msgbox itself says 'Unable to complete the operation' and 'Access is Denied'.

Has anyone seen anything like this before? I'm wondering if the message I'm getting is a red-herring.

Here's one of the scripts:
Code:

Dim fso, winShell, MyTarget, MySource, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set winShell = createObject("shell.application")

'find the current dir
dim CurDir, oShell
Set oShell = CreateObject("WScript.Shell")
CurDir = oShell.CurrentDirectory


'get source and target paths
MyTarget = fso.GetParentFolderName(curdir) & "\zip\copy.qd_calculator.zip"
MySource = fso.GetParentFolderName(CurDir) & "\standalone\calculator\"


'delete the old file, if it exists
if fso.FileExists(MyTarget) then
    fso.DeleteFile mytarget, true
end if

'create a new clean zip archive
Set file = fso.CreateTextFile(MyTarget, True)
file.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
file.close

winShell.NameSpace(MyTarget).CopyHere winShell.NameSpace(MySource).Items

do until winShell.namespace(MyTarget).items.count = winShell.namespace(MySource).items.count
    wscript.sleep 1000
loop

Set winShell = Nothing
Set fso = Nothing

MsgBox("Calculator copy zipped to:" & vbcrlf & MyTarget)


Viewing all articles
Browse latest Browse all 687

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>