Last active
October 19, 2015 08:28
-
-
Save fddcddhdd/d6b6fffd11852cd121ce to your computer and use it in GitHub Desktop.
kintoneレコードで年齢が毎日更新されるwin7用バッチファイルを作ってみた。 http://www.messiahworks.com/archives/9352
This file contains hidden or 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 | |
echo %time% | |
set APP_NO= | |
set SUB_DOMAIN= | |
set API_TOKEN= | |
rem 会員管理アプリから全レコードをダウンロード | |
echo kintone downloading... | |
cli-kintone.exe -a %APP_NO% -d %SUB_DOMAIN% -t %API_TOKEN% -c "$id,年齢" -e sjis > download.csv | |
rem アップロードファイルを初期化 | |
echo "$id","年齢">upload.csv | |
rem 本日の日付を取得 | |
set TodayDate=%date:/=% | |
rem 遅延環境変数の展開を有効化 | |
setlocal enabledelayedexpansion | |
echo age calculating... | |
for /f "skip=1 tokens=1,2,3* delims=," %%i in (download.csv) do ( | |
set yyyy_mm_dd=%%~k | |
set birth_date=!yyyy_mm_dd:-=! | |
SET /a age=TodayDate-!birth_date! | |
set /a age=!age!/10000 | |
echo %%i,!age!>> upload.csv | |
) | |
rem 遅延環境変数の展開を無効化 | |
endlocal | |
rem 計算済みの年齢をkintoneアプリへアップロードする | |
echo kintone uploading... | |
cli-kintone.exe -a 56 -d 4qn7v -t 3g7hsNrQu0d1cYGg22q9NhxzaPNdrvsJxnYvsAKY -c "$id,年齢" -e sjis -f upload.csv | |
echo %time% | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment