Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - "DeleteFolder" not works properly

Reply
 
Old 05-18-2009   #1 (permalink)
Sudhakar


 
 

"DeleteFolder" not works properly

Hello,

I'm using the VBscript to delete a folder which contains
Read-only files.

here's the code,
FileName: del.vbs
Code:
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
If ( FSO.FolderExists("C:\GPS8.0") ) Then
FSO.DeleteFolder "C:\GPS8.0",True
MsgBox "FSO.DeleteFolder C:\GPS8.0\ -OK "
*****************
when I manually execute this file, del.vbs,i.e. by double-clicking the
del.vbs, it is deleting the folder(with read-only files).
But when I trigger this .vbs file from inside a C++ application,say,using
run-time library function, system("del.vbs");, it is not.
It is emptying the folder but cannot delete the folder. After emptying the
folder, I'm getting the Error # 70, Error Description:Permission Denied

I'm the logged on user in the PC at this point of time and I 'm part of
Adminisrtator's group.
Help please.
I heard that something like admin rights or privileges needs to be sent to
the filesystem object when triggered from C++ application.

Thanks,
Sudhakar

My System SpecsSystem Spec
Old 05-18-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: "DeleteFolder" not works properly


"Sudhakar" <Sudhakar@xxxxxx> wrote in message
news:B1432178-07E3-4F92-8F31-5E6BC0A43C5A@xxxxxx
Quote:

> Hello,
>
> I'm using the VBscript to delete a folder which contains
> Read-only files.
>
> here's the code,
> FileName: del.vbs
> Code:
> Dim FSO
> Set FSO = CreateObject("Scripting.FileSystemObject")
> If ( FSO.FolderExists("C:\GPS8.0") ) Then
> FSO.DeleteFolder "C:\GPS8.0",True
> MsgBox "FSO.DeleteFolder C:\GPS8.0\ -OK "
> *****************
> when I manually execute this file, del.vbs,i.e. by double-clicking the
> del.vbs, it is deleting the folder(with read-only files).
> But when I trigger this .vbs file from inside a C++ application,say,using
> run-time library function, system("del.vbs");, it is not.
> It is emptying the folder but cannot delete the folder. After emptying the
> folder, I'm getting the Error # 70, Error Description:Permission Denied
>
> I'm the logged on user in the PC at this point of time and I 'm part of
> Adminisrtator's group.
> Help please.
> I heard that something like admin rights or privileges needs to be sent to
> the filesystem object when triggered from C++ application.
>
> Thanks,
> Sudhakar
Why would you want to invoke a VB Script file to delete a folder when you
can do it directly from C++? Having a homogenous C++ would be much cleaner
and you would not incur the overhead of invoking the VB Script interpreter.


My System SpecsSystem Spec
Old 05-18-2009   #3 (permalink)
Sudhakar


 
 

Re: "DeleteFolder" not works properly



"Pegasus [MVP]" wrote:
Quote:

>
> "Sudhakar" <Sudhakar@xxxxxx> wrote in message
> news:B1432178-07E3-4F92-8F31-5E6BC0A43C5A@xxxxxx
Quote:

> > Hello,
> >
> > I'm using the VBscript to delete a folder which contains
> > Read-only files.
> >
> > here's the code,
> > FileName: del.vbs
> > Code:
> > Dim FSO
> > Set FSO = CreateObject("Scripting.FileSystemObject")
> > If ( FSO.FolderExists("C:\GPS8.0") ) Then
> > FSO.DeleteFolder "C:\GPS8.0",True
> > MsgBox "FSO.DeleteFolder C:\GPS8.0\ -OK "
> > *****************
> > when I manually execute this file, del.vbs,i.e. by double-clicking the
> > del.vbs, it is deleting the folder(with read-only files).
> > But when I trigger this .vbs file from inside a C++ application,say,using
> > run-time library function, system("del.vbs");, it is not.
> > It is emptying the folder but cannot delete the folder. After emptying the
> > folder, I'm getting the Error # 70, Error Description:Permission Denied
> >
> > I'm the logged on user in the PC at this point of time and I 'm part of
> > Adminisrtator's group.
> > Help please.
> > I heard that something like admin rights or privileges needs to be sent to
> > the filesystem object when triggered from C++ application.
> >
> > Thanks,
> > Sudhakar
>
> Why would you want to invoke a VB Script file to delete a folder when you
> can do it directly from C++? Having a homogenous C++ would be much cleaner
> and you would not incur the overhead of invoking the VB Script interpreter.
>
> Hi ,
I'm using VBScript for various reasons. But I wannt to use VBScript only for
this purpose. PLease help using VBScript
Quote:

>
My System SpecsSystem Spec
Old 05-18-2009   #4 (permalink)
Pegasus [MVP]


 
 

Re: "DeleteFolder" not works properly


"Sudhakar" <Sudhakar@xxxxxx> wrote in message
news:7E51A768-F219-4343-BA65-6E1DBE7BB2A0@xxxxxx
Quote:

>
>
> "Pegasus [MVP]" wrote:
>
Quote:

>>
>> "Sudhakar" <Sudhakar@xxxxxx> wrote in message
>> news:B1432178-07E3-4F92-8F31-5E6BC0A43C5A@xxxxxx
Quote:

>> > Hello,
>> >
>> > I'm using the VBscript to delete a folder which contains
>> > Read-only files.
>> >
>> > here's the code,
>> > FileName: del.vbs
>> > Code:
>> > Dim FSO
>> > Set FSO = CreateObject("Scripting.FileSystemObject")
>> > If ( FSO.FolderExists("C:\GPS8.0") ) Then
>> > FSO.DeleteFolder "C:\GPS8.0",True
>> > MsgBox "FSO.DeleteFolder C:\GPS8.0\ -OK "
>> > *****************
>> > when I manually execute this file, del.vbs,i.e. by double-clicking the
>> > del.vbs, it is deleting the folder(with read-only files).
>> > But when I trigger this .vbs file from inside a C++
>> > application,say,using
>> > run-time library function, system("del.vbs");, it is not.
>> > It is emptying the folder but cannot delete the folder. After emptying
>> > the
>> > folder, I'm getting the Error # 70, Error Description:Permission Denied
>> >
>> > I'm the logged on user in the PC at this point of time and I 'm part of
>> > Adminisrtator's group.
>> > Help please.
>> > I heard that something like admin rights or privileges needs to be sent
>> > to
>> > the filesystem object when triggered from C++ application.
>> >
>> > Thanks,
>> > Sudhakar
>>
>> Why would you want to invoke a VB Script file to delete a folder when you
>> can do it directly from C++? Having a homogenous C++ would be much
>> cleaner
>> and you would not incur the overhead of invoking the VB Script
>> interpreter.
>>
>> Hi ,
> I'm using VBScript for various reasons. But I wannt to use VBScript only
> for
> this purpose. PLease help using VBScript
>
To get more verbose error messages, invoke the following batch file (not VB
Script file!) from your C++ application:
@echo off
echo %date% %time% %UserName% >> c:\test.txt
rd /s /q "c:\My Folder\SomeFolder" 1>>c:\test.txt 2>>&1

The log file c:\test.txt will probably tell you what's wrong.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
MIcrophone's wont work. "Audio not working properly"? Sound & Audio
"Provider cannot be found. It may not be properly installed Error --2146824582" Network & Sharing
"Could not perform this operation because the default mail client is not properly installed" Vista General
Search - Detail View - "Folder" is backwards - can't sort properly Vista file management
Works 8.5 in Vista: "Microsoft Works has stopped working" Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46