Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB664PE v3.10.0 is now live for X-Mas!!
#27
(12-22-2023, 07:05 PM)Kernelpanic Wrote: An example script that basically works, but the "opt" folder cannot be deleted. Even with >runas /user:Administrator ".vbs"< the folder cannot be deleted.
Maybe someone has a solution. Ultimately it's more complicated than deleting the folders by hand.

Code: (Select All)

'WSHost Ordner löschen, 22. Dez. 2023

'Variablendeklaration erzwingen
Option Explicit

Dim Pfad, OrdnerInhaltAnzeigen
Dim fso, fi, fo

Const ordner1 = "D:\QuickBasic64\qb64pe-3-8-0\internal\c\c_compiler\licenses"
Const ordner2 = "D:\QuickBasic64\qb64pe-3-8-0\internal\c\c_compiler\opt"
Const ordner3 = "D:\QuickBasic64\qb64pe-3-8-0\internal\c\c_compiler\share"

'Zum Ordner
Pfad = "D:\QuickBasic64\qb64pe-3-8-0\internal\c\c_compiler"

'FileSystemObject erzeugen fuer Zugriff
Set fso = WScript.CreateObject("Scripting.FileSystemObject")

If (Not fso.FolderExists(ordner1)) Then
WScript.Echo "Datei " & ordner1 & " existiert nicht!"
Else
fso.deleteFolder(ordner1)
WScript.Echo "Ordner " & ordner1 & " geloescht."
End if

If (Not fso.FolderExists(ordner3)) Then
WScript.Echo "Datei " & ordner3 & " existiert nicht!"
Else
fso.deleteFolder(ordner3)
WScript.Echo "Ordner " & ordner3 & " geloescht."
End if

If (Not fso.FolderExists(ordner2)) Then
WScript.Echo "Datei " & ordner2 & " existiert nicht!"
Else
fso.deleteFolder(ordner2)
WScript.Echo "Ordner " & ordner2 & " geloescht."
End if

'Beenden'
WScript.Quit

'***Ende

Many of the TCL8.6 support files in OPT are set as Read-Only, so a simple fso.deleteFolder will not work.
fso.deleteFolder has an optional "Force" flag you must use to force deletion of Read-Only files.

You can do it this way:

Const Force = True
fso.deleteFolder ordner2, Force

but

fso.deleteFolder ordner2, True

works as well.


That is why my batch file uses "RD /Q /S".  It deletes a folder and all contents regardless of attribute bits.
Reply


Messages In This Thread
RE: QB664PE v3.10.0 is now live for X-Mas!! - by JRace - 12-22-2023, 09:07 PM



Users browsing this thread: 3 Guest(s)