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 - delete folder as admin using vbscript

Reply
 
Old 07-17-2009   #1 (permalink)
Joerg Gerlach


 
 

delete folder as admin using vbscript

Hi there,

I have the following line of a vb script which does not work.

oShell.Run "runas /noprofile /user:adminuser@xxxxxx ""cmd /d /c rd /S /
Q \"C:\Dokumente und Einstellungen\All Users\Startmenü\Programme
\PowerArchiver 2001\""""

Please note the \ before "C:\Dokumente... which is needed because
runas needs the " escaped around the path.
How do I escape them correctly? Windows Script Host gives me the error
code 800A0401 when running the command at the \´s position.

Any help is appreciated.

Thanks,

J-

My System SpecsSystem Spec
Old 07-17-2009   #2 (permalink)
ekkehard.horner


 
 

Re: delete folder as admin using vbscript

Joerg Gerlach schrieb:
Quote:

> Hi there,
>
> I have the following line of a vb script which does not work.
>
> oShell.Run "runas /noprofile /user:adminuser@xxxxxx ""cmd /d /c rd /S /
> Q \"C:\Dokumente und Einstellungen\All Users\Startmenü\Programme
> \PowerArchiver 2001\""""
>
> Please note the \ before "C:\Dokumente... which is needed because
> runas needs the " escaped around the path.
> How do I escape them correctly? Windows Script Host gives me the error
> code 800A0401 when running the command at the \´s position.
>
> Any help is appreciated.
>
> Thanks,
>
> J-
To get a/one " into a string literal you need "". So to get \" the
magic incantation should be \"". This short version

"runas ""cmd x \""y\"""""

gives

runas "cmd x \"y\""

My System SpecsSystem Spec
Old 07-17-2009   #3 (permalink)
Joerg Gerlach


 
 

Re: delete folder as admin using vbscript

Works like a charm, thank you very much. =)

J-
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
VBScript to move file in one folder to many folder VB Script
Could I use vbscript to set folder quotas? VB Script
merg my acct to admin and delete? General Discussion
Admin can't delete files - help please Vista General
Can't delete files - says not Admin Vista account administration


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