batch-file - 我可以获得批处理项目的帮助吗?
问题描述
免责声明:(我知道我的标题不是很有描述性。这是因为我什至不知道错误发生在哪里,所以我没有太多可以放在那里的)
所以,我试图写一个无用的脚本来浪费时间,结果我很投入。它应该制作某种便携式垃圾文件。
这是代码:
@echo off
if not EXIST trash goto create
if EXIST trash goto exists
:create
mkdir trash
goto end
:exists
echo Would you like to delete the files inside of the trash? (y/n)
set /p YESNO=" "
if %YESNO%==n goto end
if %YESNO%==y goto check
:check
echo Please state the correct password
set /p PASSWORD = " "
if %PASSWORD%==1243 del trash\*.* /s /f /q
pause
:end
在我输入密码后检查它刚刚结束,没有错误消息,并且它不会删除垃圾文件夹中的文件。
解决方案
这有帮助吗?
@Echo Off
If Exist "trash\" GoTo exists
:create
(MD "trash" 2>NUL || Echo Failed to create trash!) & GoTo :EOF
:exists
%SystemRoot%\System32\choice.exe /M "Would you like to empty the trash"
If ErrorLevel 2 GoTo :EOF
:check
Set /P "password=Please enter the correct password>"
If "%password%" == "1243" PushD "trash" && RD /S /Q . 2>NUL & Echo Done! & PopD
Pause
推荐阅读
- python - str.同时包含多个值
- azure-devops - Azure Devops 管道,多分支触发器不起作用
- amazon-web-services - AWS CloudFormation 模板 - 必需值
- actions-on-google - 验证 Google Conversation v3 API 的 webhook 请求签名
- javascript - 基于至少两个参数的复杂决策
- java - 如何解决'线程“主”java.lang.NullPointerException中的异常'
- wordpress - Woocommerce PHP - 将产品图片添加到页面
- php - 将 WordPress 数据库表导出到包含所有元信息的 excel 文件
- php - Cake PHP 2 模型与查找器查询的关联
- python - how to replace XML values with values from a list