标题: [其他] [已解决]bat脚本提示"此时不应有 (。" [打印本页]
作者: BingjianREMIX 时间: 2023-7-11 01:09 标题: [已解决]bat脚本提示"此时不应有 (。"
本帖最后由 BingjianREMIX 于 2023-7-12 17:18 编辑
如题,该脚本没有一个"("是多余的,均成对,为何提示?
学习讨论用,该脚本原稿严禁盗版,违者追究法律责任
原稿:https://github.com/Bingjianremix/GITHUB-BATHOME
该网站为批处理之家文件暂存
作者: Batcher 时间: 2023-7-11 13:46
回复 1# BingjianREMIX
请参考Q-01观察一下哪行代码在报错以及详细的报错信息:
https://mp.weixin.qq.com/s/Koje4FufWxWBs7ioDy_LJA
如果需要上传截图,可以找个图床,例如:
http://bbs.bathome.net/thread-60985-1-1.html
作者: BingjianREMIX 时间: 2023-7-12 00:20
更改之后:- @echo off
- title MICRODOS COMMAND LINE
- color 07
- cd /d "%~dp0"
-
- :microdos
- cls
- echo MICRODOS COMMAND LINE [Version 25.0.23629.1612]
- echo (C) REMIX LASER RISING STUDIO. All rights reserved.
- echo.
-
- :microdos2
- set "a=x"
- set /p a=%cd%^>
- set "a=x" & if /i "%a%" equ "x" (
- goto :microdos2
- ) else if /i "%a%" equ "MICRODOS /?" (
- goto :microdoshelp
- ) else if /i "%a%" equ "echo on" (
- echo.
- goto :microdos2
- ) else if "%a%" equ "ver" (
- echo.
- echo MICRODOS COMMAND LINE [Version 25.0.23629.1612]
- echo.
- goto :microdos2
- ) else if /i "%a:~0,11%" equ "MICRODOS /YA" (
- set "file=%a:~12%"
- if "x%a:~12%" equ "x" (
- set /p "hide=What file you want to hide:"
- set "file=%hide%"
- )
- attrib +s +h "%file%"
- goto :microdos2
- ) else if /i "%a:~0,11%" equ "MICRODOS /NA" (
- set "file2=%a:~12%"
- if "x%a:~12%" equ "x" (
- set /p "show=What file you want to show:"
- set "file2=%show%"
- )
- attrib -s -h "%file2%"
- goto :microdos2
- ) else if /i "%a:~0,11%" equ "MICRODOS /C" (
- set "file3=%a:~12%"
- if not exist "%file3%" (
- set /p "duplicate=Which file do you want to find duplicate lines in:"
- set "file3=%duplicate%"
- ) else if exist "%file3%" (
- for /f "delims=" %%i in ('type "%file3%"^|sort') do (
- setlocal enabledelayedexpansion
- if not defined line[%%i] (
- set "line[%%i]=1"
- echo %%i>>output.txt
- )
- endlocal
- )
- )
- ren "output.txt" "%file3%"
- goto :microdos2
- ) else if /i "%a:~0,11%" equ "MICRODOS /D" (
- dir /s /b "%a:~11%"
- goto :microdos2
- ) else if /i "%a:~0,11%" equ "MICRODOS /T" (
- set "file4=%a:~12%"
- if "x%a:~12%" equ "x" (
- set /p "own=Which file do you want to get ownership of:"
- set "file4=%own%"
- )
- takeown /f "%file4%" && icacls "%file4%" /grant Users:F
- goto :microdos2
- ) else if /i "%a:~0,11%" equ "MICRODOS /M" goto :microdos
-
- else echo. & %a%
- goto :microdos2
-
- :microdoshelp
- echo Convenient advanced command line
- echo.
- echo MICRODOS [/YA;/NA] [/C] [/D] [/T] [/M]
- echo.
- echo /A Hide or show the specified file
- echo /C Find duplicate lines in the specified file
- echo /D Lists the contents of the specified folder
- echo /T Take ownership of the administrator
- echo /M Show the main interface
- echo.
- pause
- echo.
- goto :microdos2
复制代码
虽然没有报标题的错了,但是引出了更多问题
作者: 77七 时间: 2023-7-12 16:44
本帖最后由 77七 于 2023-7-12 16:47 编辑
- @echo off
- set a=x & echo %a%
- (
- set /p b=
- echo %b%
- )
- pause
复制代码
参考 http://www.bathome.net/thread-2899-1-1.html
包括这个 http://bbs.bathome.net/thread-66756-1-1.html 的疑问,你学习完上面的帖子,应该能够解决
作者: BingjianREMIX 时间: 2023-7-12 17:17
回复 4# 77七
懂了,原来它是没有限制的http://bbs.bathome.net/thread-66756-1-1.html
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |