MSFN Forum: Need VB help - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Need VB help Rate Topic: -----

#1 User is offline   Daimao 

  • Junior
  • Pip
  • Group: Members
  • Posts: 55
  • Joined: 14-September 04

Posted 05 May 2008 - 02:29 PM

I need a script to delete a certain folder in all users/start menu/programs
and it has to be language independent
thx to whoever helps me


#2 User is offline   Daimao 

  • Junior
  • Pip
  • Group: Members
  • Posts: 55
  • Joined: 14-September 04

Posted 06 May 2008 - 05:46 AM

This should work then



Const SMP = &H17&
Set oShell = CreateObject("Shell.Application")
Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolderItem = oShell.Namespace(SMP).Self
	fso.DeleteFolder oFolderItem.Path & "\RA", true

This post has been edited by Daimao: 06 May 2008 - 07:26 AM


#3 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,019
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 06 May 2008 - 08:17 AM

Here is the same script except I added a check to see if the folder exists.

Quote

 Const SMP = &H17&
 Dim Fso, oShell,oFolderItem, Target
 Set oShell = CreateObject("Shell.Application")
 Set Fso = CreateObject("Scripting.FileSystemObject")
 Set oFolderItem = oShell.Namespace(SMP).Self
'/-> Replace Your_Folder_Name With The Name Of The Folder
  Target = oFolderItem.Path & "\Your_Folder_Name"
   If Fso.FolderExists(Target) Then
	Fso.DeleteFolder(Target)
   Else
	MsgBox "This folder does not exists" & vbCrLf & Target,4128,"Missing Folder"
   End If


#4 User is offline   Daimao 

  • Junior
  • Pip
  • Group: Members
  • Posts: 55
  • Joined: 14-September 04

Posted 06 May 2008 - 11:52 AM

Thank you
I don't know any VB at all so all help was welcome ^^

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy