@echo off setlocal :: http://stackoverflow.com/questions/203090/how-to-get-current-datetime-on-windows-command-line-in-a-suitable-format-for-us for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%b-%%a) echo The current date is %mydate% :: currentdir (C:\Research\Nightly) set currentdir=%CD% :: Need to edit rke-setup.bat and fill it in with local env vars values if not exist %currentdir%\tools\expeditee-release-kits\rke-setup.bat ( echo. echo ******************* echo. echo First edit %currentdir%\tools\expeditee-release-kits\rke-setup.bat.in echo to generate %currentdir%\tools\expeditee-release-kits\rke-setup.bat echo. echo ******************* echo. goto end ) :: rke-setup.bat uses local paths, so cd into expeditee-release-kits first :: then call rke-setup.bat to source the environment vars it sets pushd %currentdir%\tools\expeditee-release-kits call rke-setup.bat if ERRORLEVEL 1 ( echo error level 1 or more popd exit /B 1 ) popd :: Make sure the expeditee folder and its rke-build.properties file exist :: Then run the 'rke' command from snapshots\expeditee pushd %currentdir%\snapshots ::http://www.robvanderwoude.com/battech_ifexistfolder.php if exist expeditee\ echo Deleting snapshots\expeditee&& rmdir /s /q expeditee if not exist expeditee\ mkdir expeditee if not exist expeditee\rke-build.properties copy C:\Research\Nightly\tools\expeditee-release-kits\rke-build.properties.in expeditee\rke-build.properties pushd expeditee call rke :: Uploading mkdir uploads copy products\Expeditee-1%products_suffix%.exe uploads\Expeditee-1-%mydate%%uploads_suffix%.exe copy rke.out uploads\rke-%mydate%%os_suffix%.out set PATH=C:\Windows\System32\linuxtools;C:\Program Files (x86)\PuTTY2;%PATH% :: Works from the cmd line: :: cd uploads && tar.exe -c * | plink.exe -T -i "C:\Research\Nightly\tools\keys\upload-expeditee.ppk" USER@MACHINE.cms.waikato.ac.nz :: The following setcmd ends up partially running the cmd and uploading everything in snapshots\expeditee onto the remote machine rem set upload_cmd=cd uploads && tar -c * | plink -T -i "C:\Research\Nightly\tools\keys\upload-expeditee.ppk" USER@MACHINE.cms.waikato.ac.nz rem echo %upload_cmd% cd uploads && tar -c * | plink -T -i "%identity_file%" anupama@wharariki.cms.waikato.ac.nz :end cd %currentdir% endlocal ::exit