Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Directory Create Utility
#7
This is probably easier to do with VBScript (Windows Scripting Host).
The program example should show that you can also delete under Windows without asking. I have now changed it so that a folder is created via the query, which is then automatically after 5 seconds deleted again. That could certainly be easily converted to create any folder. In the end it's more of a gimmick. But one can learn from it.

In my example, the folder "Beispiel" is created in H:\Ablage\Beispiel. Adapt it to your own system when trying it out. Name: XYZ.vbs

Code: (Select All)
'Windows Scripting Host Beispiel, 15. April 2019/14. Sept. 2022
'Erstellt einen Ordner und löscht ihn nach 5 sek. ohne Abfrage

'Variablendeklaration erzwingen
Option Explicit

Dim Pfad, NeuerPfad, OrdnerAnzeigen
Dim fso, fo

NeuerPfad = Inputbox("Neuen Ordner mit Pfad angeben: ")
'Hier: H:\Ablage\Beispiel

Pfad = NeuerPfad

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

'Pruefen ob Ordner schon existiert
If (Not fso.FolderExists(Pfad)) Then
'Ordner erstellen
Set fo = fso.CreateFolder(Pfad)
End If

'Neu erstellten Ordner anzeigen
OrdnerAnzeigen = fso.GetParentFolderName(Pfad)
Set fo = fso.GetFolder(OrdnerAnzeigen)

'5 Sekunden warten
WScript.Sleep 5000

'Ordner ohne Nachfrage loeschen
fso.DeleteFolder(Pfad)
WScript.Quit

'***Ende
Reply


Messages In This Thread
Directory Create Utility - by eoredson - 09-16-2022, 02:58 AM
RE: Directory Create Utility - by SpriggsySpriggs - 09-16-2022, 01:07 PM
RE: Directory Create Utility - by Pete - 09-16-2022, 03:18 PM
RE: Directory Create Utility - by eoredson - 09-17-2022, 02:03 AM
RE: Directory Create Utility - by SpriggsySpriggs - 09-16-2022, 06:10 PM
RE: Directory Create Utility - by Pete - 09-17-2022, 03:48 AM
RE: Directory Create Utility - by Kernelpanic - 09-17-2022, 11:43 AM



Users browsing this thread: 7 Guest(s)