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

[其他] [已解决]bat脚本提示"此时不应有 (。"

本帖最后由 BingjianREMIX 于 2023-7-12 17:18 编辑

如题,该脚本没有一个"("是多余的,均成对,为何提示?
学习讨论用,该脚本原稿严禁盗版,违者追究法律责任
原稿:https://github.com/Bingjianremix/GITHUB-BATHOME
该网站为批处理之家文件暂存
QQ 1980286392

回复 1# BingjianREMIX


请参考Q-01观察一下哪行代码在报错以及详细的报错信息:
https://mp.weixin.qq.com/s/Koje4FufWxWBs7ioDy_LJA

如果需要上传截图,可以找个图床,例如:
http://bbs.bathome.net/thread-60985-1-1.html
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

更改之后:
  1. @echo off
  2. title MICRODOS COMMAND LINE
  3. color 07
  4. cd /d "%~dp0"
  5. :microdos
  6. cls
  7. echo MICRODOS COMMAND LINE [Version 25.0.23629.1612]
  8. echo (C) REMIX LASER RISING STUDIO. All rights reserved.
  9. echo.
  10. :microdos2
  11. set "a=x"
  12. set /p a=%cd%^>
  13. set "a=x" & if /i "%a%" equ "x" (
  14. goto :microdos2
  15. ) else if /i "%a%" equ "MICRODOS /?" (
  16. goto :microdoshelp
  17. ) else if /i "%a%" equ "echo on" (
  18. echo.
  19. goto :microdos2
  20. ) else if "%a%" equ "ver" (
  21. echo.
  22. echo MICRODOS COMMAND LINE [Version 25.0.23629.1612]
  23. echo.
  24. goto :microdos2
  25. ) else if /i "%a:~0,11%" equ "MICRODOS /YA" (
  26. set "file=%a:~12%"
  27. if "x%a:~12%" equ "x" (
  28. set /p "hide=What file you want to hide:"
  29. set "file=%hide%"
  30. )
  31. attrib +s +h "%file%"
  32. goto :microdos2
  33. ) else if /i "%a:~0,11%" equ "MICRODOS /NA" (
  34. set "file2=%a:~12%"
  35. if "x%a:~12%" equ "x" (
  36. set /p "show=What file you want to show:"
  37. set "file2=%show%"
  38. )
  39. attrib -s -h "%file2%"
  40. goto :microdos2
  41. ) else if /i "%a:~0,11%" equ "MICRODOS /C" (
  42. set "file3=%a:~12%"
  43. if not exist "%file3%" (
  44. set /p "duplicate=Which file do you want to find duplicate lines in:"
  45. set "file3=%duplicate%"
  46. ) else if exist "%file3%" (
  47. for /f "delims=" %%i in ('type "%file3%"^|sort') do (
  48. setlocal enabledelayedexpansion
  49. if not defined line[%%i] (
  50. set "line[%%i]=1"
  51. echo %%i>>output.txt
  52. )
  53. endlocal
  54. )
  55. )
  56. ren "output.txt" "%file3%"
  57. goto :microdos2
  58. ) else if /i "%a:~0,11%" equ "MICRODOS /D" (
  59. dir /s /b "%a:~11%"
  60. goto :microdos2
  61. ) else if /i "%a:~0,11%" equ "MICRODOS /T" (
  62. set "file4=%a:~12%"
  63. if "x%a:~12%" equ "x" (
  64. set /p "own=Which file do you want to get ownership of:"
  65. set "file4=%own%"
  66. )
  67. takeown /f "%file4%" && icacls "%file4%" /grant Users:F
  68. goto :microdos2
  69. ) else if /i "%a:~0,11%" equ "MICRODOS /M" goto :microdos
  70. else echo. & %a%
  71. goto :microdos2
  72. :microdoshelp
  73. echo Convenient advanced command line
  74. echo.
  75. echo MICRODOS [/YA;/NA] [/C] [/D] [/T] [/M]
  76. echo.
  77. echo /A   Hide or show the specified file
  78. echo /C   Find duplicate lines in the specified file
  79. echo /D   Lists the contents of the specified folder
  80. echo /T   Take ownership of the administrator
  81. echo /M   Show the main interface
  82. echo.
  83. pause
  84. echo.
  85. goto :microdos2
复制代码
虽然没有报标题的错了,但是引出了更多问题
QQ 1980286392

TOP

本帖最后由 77七 于 2023-7-12 16:47 编辑
  1. @echo off
  2. set a=x & echo %a%
  3. (
  4. set /p b=
  5. echo %b%
  6. )
  7. pause
复制代码


参考 http://www.bathome.net/thread-2899-1-1.html
包括这个 http://bbs.bathome.net/thread-66756-1-1.html 的疑问,你学习完上面的帖子,应该能够解决
bat小白,请多指教!谢谢!

TOP

回复 4# 77七


    懂了,原来它是没有限制的http://bbs.bathome.net/thread-66756-1-1.html
QQ 1980286392

TOP

返回列表