You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 周之前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set cmdstr=rsync
  4. set zipfile=cwrsync.zip
  5. set downurl=https://itefix.net/dl/free-software/cwrsync_6.3.0_x64_free.zip
  6. set currpath=%~dp0
  7. set "rsynchome=%ProgramFiles%\%zipfile:~0,-4%"
  8. set passfile=%temp%\.password
  9. set syncdir=dist/
  10. :: Ҫͬ
  11. set accountwithost=kszny@47.96.93.140::line
  12. set "password=kszny@123"
  13. set "runcommand=%cmdstr% --port=873 -rlptvz --progress --password-file=%passfile% --exclude=google.exe --exclude=Lodap.zip %syncdir% %accountwithost%"
  14. where %cmdstr% >nul 2>nul
  15. ::д˵ڸ
  16. if %errorlevel% neq 0 (
  17. ::δذװδѹװĿ¼
  18. if not exist "%rsynchome%" (
  19. :: ԱȨ
  20. echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\runAsAdmin.vbs"
  21. echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\runAsAdmin.vbs"
  22. "%temp%\runAsAdmin.vbs"
  23. :: ҪԱȨ޲ܴĿ¼
  24. mkdir "%rsynchome%"
  25. del "%temp%\runAsAdmin.vbs"
  26. exit /B
  27. )
  28. :: ʹpowershellcurl
  29. powershell curl -o %temp%\%zipfile% %downurl%
  30. :: ѹ
  31. tar -xf "%temp%\%zipfile%" -C "%rsynchome%"
  32. echo "%cmdstr%Ѿװ%rsynchome%Ŀ¼"
  33. :: ·Ƿ PATH
  34. set "found=false"
  35. for %%I in ("%PATH:;=";"%") do (
  36. if /I "%%~I"=="%rsynchome%\bin" (
  37. set "found=true"
  38. )
  39. )
  40. :: δõpathУӵpath
  41. if "!found!"=="false" (
  42. :: עе PATH ͨsetxʽֵȳ1024ַͻᱻض
  43. reg add "HKCU\Environment" /v PATH /t REG_EXPAND_SZ /d "%PATH%;%rsynchome%\bin" /f
  44. )
  45. )
  46. ::ǰĿ¼ûdistĿ¼
  47. if not exist "%currpath%%syncdir%" (
  48. echo ǰĿ¼ûҪͬ%syncdir%Ŀ¼Ҫͬ%syncdir%Ŀ¼ǰĿ¼£
  49. ) else (
  50. echo !password!>%passfile%
  51. echo ͬʼԺ...
  52. !runcommand! && (
  53. echo ͬ!
  54. ) || (
  55. echo !runcommand!
  56. echo ͬʧܣȷǷVPN
  57. )
  58. del %passfile%
  59. )
  60. endlocal
  61. pause