[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] [已解决]求助修改安装FileZilla Server的批处理

  1. @echo off
  2. if exist "C:\Progra~2\FileZilla Server\FileZilla Server.xml" (
  3. goto install86
  4. ) else (
  5. goto install64
  6. )
  7. :install86
  8. del /s /q /f "C:\Progra~2\FileZilla Server\FileZilla Server.xml
  9. move "%~dp0\FileZilla Server.xml" "C:\Progra~2\FileZilla Server"
  10. NET STOP "FileZilla Server"&&NET START "FileZilla Server"
  11. goto allinstallok
  12. :install64
  13. if exist "C:\Progra~1\FileZilla Server\FileZilla Server.xml" (
  14. goto installin
  15. ) else (
  16. goto out
  17. )
  18. :installin
  19. del /s /q /f "C:\Progra~1\FileZilla Server\FileZilla Server.xml
  20. move "%~dp0\FileZilla Server.xml" "C:\Progra~1\FileZilla Server"
  21. NET STOP "FileZilla Server"&&NET START "FileZilla Server"
  22. goto allinstallok
  23. :allinstallok
  24. echo. >>ipaddress.txt
  25. echo. >>ipaddress.txt
  26. echo 程序部署完成 >>ipaddress.txt
  27. echo. >>ipaddress.txt
  28. echo 以下为本机IP信息,请拍照或者记录 >>ipaddress.txt
  29. echo. >>ipaddress.txt
  30. echo ------------------------------------------------------>>ipaddress.txt
  31. echo. >>ipaddress.txt
  32. ipconfig | findstr "IPv4 地址">>ipaddress.txt
  33. echo. >>ipaddress.txt
  34. echo ------------------------------------------------------>>ipaddress.txt
  35. start notepad "ipaddress.txt"
  36. ping /n 2 127.1>nul
  37. del /q ipaddress.txt
  38. ver|findstr "5.1" >nul && (
  39.     set "m=ipconfig^|findstr /i "ip address""
  40. )|| (
  41.     set "m=ipconfig^|findstr /i "ipv4""
  42. )
  43. for /f "tokens=14* delims=: " %%1 in ('%m%')do start "" "ftp://%%2:18003"
  44. set /p clean="是否需要清理安装文件 Y / N ?"
  45.     if /i "%clean%"=="Y" cd /d ... & rd /s /q "%~dp0"
  46.     if /i "%clean%"!="Y" exit
  47. :out
  48. echo.
  49. echo.
  50. echo                            没有找到安装文件,请确认是否已完成安装
  51. echo.
  52. pause
复制代码
问题1:有的电脑能运行,有的不能运行,直接跳到OUT 提示 没有找到安装文件,请确认是否已完成安装.
问题2:无法删除文件夹本身
1

评分人数

    • Batcher: 感谢给帖子标题标注[已解决]字样PB + 2

回复 2# Batcher
默认的安装文件夹呀

TOP

回复 4# Batcher

回头我再试试。这个文件应该是存在的,安装完才会运行这个批处理,就是觉得替换配置文件重启服务器太麻烦才写的这个。
删除文件夹的代码好像是有问题的,无法删除文件夹

TOP

回复  newgain


:install64
if exist "C:\Progra~1\FileZilla Server\FileZilla Server.xml" (
goto ...
Batcher 发表于 2019-10-23 17:08



    不存在这个文件说明 软件安装包没有安装,所以退出批处理

TOP

  1. @echo off
  2. if exist "C:\Program Files (x86)\FileZilla Server\FileZilla Server.xml" (
  3. goto install64
  4. ) else (
  5. goto install86
  6. )
  7. :install86
  8. if exist "C:\Program Files\FileZilla Server\FileZilla Server.xml" (
  9. goto installin
  10. ) else (
  11. goto out
  12. )
  13. :install64
  14. del /s /q /f "C:\Program Files (x86)\FileZilla Server\FileZilla Server.xml
  15. move "%~dp0\FileZilla Server.xml" "C:\Program Files (x86)\FileZilla Server"
  16. NET STOP "FileZilla Server"&&NET START "FileZilla Server"
  17. goto allinstallok
  18. :installin
  19. del /s /q /f "C:\Program Files\FileZilla Server\FileZilla Server.xml
  20. move "%~dp0\FileZilla Server.xml" "C:\Program Files\FileZilla Server"
  21. NET STOP "FileZilla Server"&&NET START "FileZilla Server"
  22. goto allinstallok
  23. :allinstallok
  24. echo. >>ipaddress.txt
  25. echo. >>ipaddress.txt
  26. echo 程序部署完成 >>ipaddress.txt
  27. echo. >>ipaddress.txt
  28. echo 以下为本机IP信息,请拍照或者记录 >>ipaddress.txt
  29. echo. >>ipaddress.txt
  30. echo ------------------------------------------------------>>ipaddress.txt
  31. echo. >>ipaddress.txt
  32. ipconfig | findstr "IPv4 地址">>ipaddress.txt
  33. echo. >>ipaddress.txt
  34. echo ------------------------------------------------------>>ipaddress.txt
  35. start notepad "ipaddress.txt"
  36. ping /n 2 127.1>nul
  37. del /q ipaddress.txt
  38. ver|findstr "5.1" >nul && (
  39.     set "m=ipconfig^|findstr /i "ip address""
  40. )|| (
  41.     set "m=ipconfig^|findstr /i "ipv4""
  42. )
  43. for /f "tokens=14* delims=: " %%1 in ('%m%')do start "" "ftp://%%2:18003"
  44. set /p clean="是否需要清理安装文件 Y / N ?"
  45.     if /i "%clean%"=="Y" cd /d ...&rd /s /q %~dp0
  46.     if /i "%clean%"!="Y" exit
  47. :out
  48. echo.
  49. echo.
  50. echo                            没有找到安装文件,请确认是否已完成安装
  51. echo.
  52. pause
复制代码
修改了一下,本机测试没问题,自动清理安装程序也没问题了

TOP

返回列表