Last active
February 16, 2017 18:28
-
-
Save abathur/37fbdada8c8b29ae0b781ca62539e984 to your computer and use it in GitHub Desktop.
Check the server_file once an hour for changes and pop-up a notification if it has.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Copy both files into your user dir (C:/users/<username>) | |
2. edit the "server_file" path on line 4 of file_differs.bat to use the network file location of your excel sheet | |
3. Save the edits | |
4. Click your Start button | |
5. Type "cmd" and hit enter | |
6. In the cmd window, type "file_differs.vbs" and hit enter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
set server_file=\\server\file\path | |
set compare_file=%USERPROFILE%\file_differs_compare | |
set task_name=monitor_excel_sheet | |
schtasks /delete /f /TN %task_name% > nul | |
schtasks /create /TN %task_name% /sc hourly /tr "%USERPROFILE%\file_differs.vbs" > nul | |
fc /b %server_file% %compare_file% > nul | |
if errorlevel 1 ( | |
for %%a in (%server_file%) do set mod_time=%%~ta | |
msg * "%server_file% updated @ !mod_time!" | |
cp %server_file% %compare_file% | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set WshShell = CreateObject("WScript.Shell") | |
WshShell.run chr(34) & "%USERPROFILE%/file_differs.bat" & Chr(34), 0 | |
Set WshShell = Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment