0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Batファイルまとめ

Last updated at Posted at 2017-03-14

ネットワークドライブの疎通確認

↓は実在するフォルダ p:\main\ に対する疎通確認の例

if.bat
if not exist P:\main\ (
	実行したい処理
)

ログを追記する

記録先はbatファイルと同一フォルダにあるエラー記録.log

ログ追記.bat
echo "文字列" >> %0\..\エラー記録.log

###日付と時間と文字列を記録

日時と文字列書き出し.bat
echo %date% %time%  "Pドライブ接続失敗">> %0\..\P_errLog.txt

###5秒ごとに繰り返す

repert5sec
:top
timeout 5
 繰り返したい処理
goto top

###全部まとめると↓

chkNAS.bat
:top
timeout 5
if not exist P:\main\ (
	echo %date% %time%  "Pドライブ接続失敗">> %0\..\P_errLog.txt
)
goto top
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?