Skip to content

Instantly share code, notes, and snippets.

@abathur
Last active February 16, 2017 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abathur/37fbdada8c8b29ae0b781ca62539e984 to your computer and use it in GitHub Desktop.
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.
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.
@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%
)
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