Author Topic: DirExist() on network drive  (Read 4141 times)


  • Jr. Member
  • **
  • Posts: 75
  • Let's go Brandon
DirExist() on network drive
« on: July 03, 2013, 02:10:51 pm »
This test fails (results in Not Exist message):

Code: Winbatch
If DirExist(`P:\Tech\Updates`) Then Message("Yes","Drive Exists")
Else Message('No','Not Exist')

However, if I open a cmd window the folder definitely exists.  Why does the above test fail?

The P: drive is mapped to an SMB share on a Linux box, as follows:

net use p: \\\THESHARE

My script is being run on a Win7HP machine.  Everything else seems to work with this drive: Explorer, Word 2010, Excel 2010, DOS, etc.

I am running the script in debug mode inside the Winbatch Studio.

Is this a pandemic... or an IQ test?


  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: DirExist() on network drive
« Reply #1 on: July 03, 2013, 02:24:24 pm »
Are you logged in as an administrator? If so you have two user contexts: standard user and full admin. By default script run using WinBatch are manifested to run using the highest available user context, so if you are logged into an administrator account the script will run with full admin elevation.  Sometimes when you map the drive, using the standard user context , that drive is not seen by a script running in the administrator context.

Luckily, you can specify a different manifest for your scripts, by simply running the AsInvoker manifested version of WinBatch Studio located here: C:\Program Files (x86)\WinBatch\System\WinBatch_IF.EXE. Launch this version and load your script and test.

Deana F.
Technical Support
Wilson WindowWare Inc.