提问人:Daniel Askew 提问时间:10/31/2023 最后编辑:CompoDaniel Askew 更新时间:10/31/2023 访问量:56
批处理崩溃没有错误,我怎样才能找到问题?
Batch Crashes Without Error, How Can I Find The Problem?
问:
当我使用测试链接(例如 or 甚至)时,一切都在工作,它会继续到下一行。但是,当我输入实际的 YouTube URL 时,CMD 崩溃没有给出任何错误。我甚至转过身去看看发生了什么,但它只会崩溃。youtube
youtube.com
https://youtube.com/test
ECHO on
@ECHO OFF
:back1
echo Please enter a file name, make sure to add ".webm" to the end for formatting reasons:
set/p "file=>"
if x%file:.webm=%==x%file% goto linkER
goto back2
:linkER
cecho {0C}INVALID ENTRY it is CRITICAL to get this part right! {#}
goto back1
:back2
echo Please paste the YouTube link:
set/p "link=>"
if %link%==0 (goto Invalid)
if x%link:youtube=%==x%link% goto Youtube
goto start_time
:Invalid
cecho {0C}INVALID ENTRY {#}
goto back2
:Youtube
cecho {0C}INVALID ENTRY: Must contain "Youtube" {#}
goto back2
这应该是理解重点所需的唯一代码块,尽管还有更多。
有没有人知道它可能是什么或我可以尝试什么?
答:
0赞
JoyNa
10/31/2023
#1
一个可能的问题可能是处理真实 YouTube URL 的方式。尝试更改检查链接/URL 是否存在的行。这将确保它继续进行 .start-time
您可能想要更改此行:
if x%link:youtube=%==x%link% goto Youtube
像这样:
if not "%link:youtube=%"=="" goto start_time
如果这有什么不同,请告诉我。
评论
0赞
Daniel Askew
11/1/2023
嗨,JoyNa!感谢您在这里的输入,但我试图在这个等式中做的是从字符串“link”中删除 prase “youtube”,然后将其与原始链接字符串进行比较,看看原始链接字符串是否在任何地方都有“youtube”。这样做的原因是为了检查它是否是 YouTube URL
评论
cmd.exe
cmd.exe
@ECHO OFF
cmd
set/p "file=>"
set
/p
cecho
echo
:back1
echo
set "file="
set/p "file=>"
set /P "file=>" || goto linkER
set "file=%file:"=%"
"
if not defined file goto linkER
"
if x%file:.webm=%==x%file% goto linkER
for %%G in ("%file%") do if /I not "%%~xG" == ".webm" if "%%~xG" == "" (set "file=%file%.webm") else goto linkER
.webm
.webm
.webm
linkEr
cecho
cecho
cecho
call "%~dp0cecho.bat"
call "%~dp0cecho.cmd"
cecho
cecho
"%~dp0cecho.exe"