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.

Can someone please help me with if exist command

Featured Replies

I would like to change My Documents to D:\ but only if D:\ exists, I don't know what command would do this. I found this in another thread which changes My Documents to D:\

;Change location of my documents
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
"Personal" ="D:\\"

I would like for it to look if D:\ exists and if it does then apply the reg entry..

Thank you

Sull


You can script it through a batch file. It would be something like:

if exist d:\ goto script

goto end

:script

regedit /S filename.reg

:end

exit

Is that what you are looking for?

  • Author

Yes that is what I am looking for, now will that work or does it need to be more advanced than that ?

also as Yzöwl said make sure D:\ is not CD/DVD or removable

Here is a VBS script that checks

1:\ It a hard drive

2:\ Checks For D Drive

3:\ Checks To Make Sure The Reg File Exists

You will have to supply the path to the reg file

Save As CheckDrv.vbs

 Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Drv, Reg
Reg = "Your\Path\To\Reg.reg"
For Each Drv In Fso.Drives
If Drv.DriveType = 2 Then '-> Make Sure It A Hard Drive
If InStr(Drv.DriveLetter,"D") Then '-> Checks The Drive Letter
If Fso.FileExists(Reg) Then '-> Make Sure The Reg File Exists
Act.Run("regedit /S " & Reg),0,True
End If
End If
End If
Next

  • Author

Thank you, would the location below be ok ?

 Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Drv, Reg
Reg = "%SYSTEMDRIVE%\Install\DS.reg"
For Each Drv In Fso.Drives
If Drv.DriveType = 2 Then '-> Make Sure It A Hard Drive
If InStr(Drv.DriveLetter,"D") Then '-> Checks The Drive Letter
If Fso.FileExists(Reg) Then '-> Make Sure The Reg File Exists
Act.Run("regedit /S " & Reg),0,True
End If
End If
End If
Next

Now can I just run this script from my cleanup.cmd ?

Thank you, would the location below be ok ?

No Change It To This

 Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Drv, Reg
Reg = Act.ExpandEnvironmentStrings("%SYSTEMDRIVE%\Install\DS.reg")
For Each Drv In Fso.Drives
If Drv.DriveType = 2 Then '-> Make Sure It A Hard Drive
If InStr(Drv.DriveLetter,"D") Then '-> Checks The Drive Letter
If Fso.FileExists(Reg) Then '-> Make Sure The Reg File Exists
Act.Run("regedit /S " & Reg),0,True
End If
End If
End If
Next

Now can I just run this script from my cleanup.cmd ?

Yes you can

  • Author

gunsmokingman,

Thanks I will test it out soon. I would like to learn how to write these vbs scripts, do you know of any good sites or guides ?

Appreciate the help

Sull

gunsmokingman is the VBS scripting guy around these parts (except for the other scripting guy in the link given, :)), but if your into VBS then the script56.chm is quite valuable also (at least for me).

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.