Advertisement
Guest User

CheckNetworkDrive

a guest
Feb 21st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.75 KB | None | 0 0
  1. @echo off
  2. echo Checking network connectivity to the network.
  3. ping -n 5 192.168.1.1 >nul
  4. if "!errorlevel!" EQU "0" (
  5. echo Unable to find an internet connection. Please see your Systems Administrator for assistance.
  6. goto:Exit
  7.     else (
  8.     goto:CheckDrive
  9.     )
  10. )
  11. :CheckDrive
  12. if exist SETDRIVELETTER (
  13.     echo You already have access to the network drive. Opening drive.
  14.         %SystemRoot%\explorer.exe "SETDRIVELETTER"
  15.     goto:Exit
  16.     else (
  17.     echo The network drive was not found. Attempting to reconnect.
  18.     net use SETDRIVELETTER \\NETWORKDRIVELOCATION\FOLDER\ /USER:USERNAME PASSWORD /p:yes
  19.     echo You should now have access to the network drive. Attempting to open drive.
  20.     %SystemRoot%\explorer.exe "\\NETWORKDRIVELOCATION\FOLDER"
  21.     goto:Exit
  22.     )
  23. )
  24. :Exit
  25. Pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement