@echo off set netuse=C:\exe\NetUse.exe(ネットワーク接続exe) set netroot=\\サーバ名\test set netpath=\\サーバ名\test\テスト dir %netpath% > null if not errorlevel 1 goto open_explorer if not exist %netuse% goto exit_batch %netuse% %netroot% dir %netpath% > null if errorlevel 1 goto exit_batch :open_explorer start "" explorer /e, /root, %netpath% :exit_batch del null