0

I have a DFS namespace url and want rom time to time to test from another server that uses those resources is access to namespace is permitted.

Manually from CMD I would do something like dir "\\namespaceURL" and the results will be the files and dirs from that namespace.

I just want to configure an alert and trigger a task when the dir command does not return anything. I am thinking at something like:

If (dir "\\namespaceURL" is ok) echo "available" else echo "not-available"   

Can you guys have a look over this and let me know your thoughts?

aschipfl
  • 33,626
  • 12
  • 54
  • 99
John_otto
  • 17
  • 1
  • 7

1 Answers1

0

if exist should be the way to go, but if you want to use dir, here is the syntax:

dir "\\namespaceURL" >nul 2>&1 && (echo found) || (echo no access)
Stephan
  • 53,940
  • 10
  • 58
  • 91