Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How can I delete a relative parent folder using vbs?

Featured Replies

I need to delete the parent folder that the vbs script is in. For example, if the vbs script is in the folder "New", I need to delete the folder with everything in it using the script.

No guarantee that this would work because the script will be in use, but if it does work, this would do it:

Dim FSO
Dim FolderPath

Set FSO = CreateObject("Scripting.FileSystemObject")
FolderPath = FSO.GetParentFolderName(WScript.ScriptFullName)
FSO.DeleteFolder FolderPath, True
Set FSO = Nothing

  • Author
No guarantee that this would work because the script will be in use, but if it does work, this would do it:

Dim FSO
Dim FolderPath

Set FSO = CreateObject("Scripting.FileSystemObject")
FolderPath = FSO.GetParentFolderName(WScript.ScriptFullName)
FSO.DeleteFolder FolderPath, True
Set FSO = Nothing

Is there a way the script can be stored in a temporary location just before execution, so that the folder is not locked while its execution?

Do you think batch commands can do it?

Edited by srk999

As stated above the following will work:

Set oFS = CreateObject("Scripting.FileSystemObject")
MyParent = oFS.GetParentFolderName(WScript.ScriptFullName)
oFS.DeleteFolder MyParent, True

Just make the bottom line the last one in your VBScript.

The following batch file will work fine too:

ntscript.cmd

@Set "C_=X:\MyDir\New\some.vbs"
@For %%# In (%C_%) Do @Set "P_=%%~dp#"&@%C_%&&@Rd/s/q "%P_%"

If you wish you could run your vbs using '@cscript //nologo %C_%' too!

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.