Skip to content

Commit 6b57340

Browse files
Merge pull request #97 from jinwandalaohu66/submission/cmd1_0_mnleeeta
2 parents b3b6838 + baf4b71 commit 6b57340

2 files changed

Lines changed: 121 additions & 2 deletions

File tree

script_library/index.json

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 1,
3-
"data_version": 79,
4-
"updated": "2026-04-05T04:05:13.290Z",
3+
"data_version": 80,
4+
"updated": "2026-04-05T06:46:23.849Z",
55
"announcement": null,
66
"categories": [
77
{
@@ -1281,6 +1281,29 @@
12811281
"updated": null,
12821282
"status": "active",
12831283
"lines": 187
1284+
},
1285+
{
1286+
"id": "cmd1_0_mnleeeta",
1287+
"name": "模拟cmd1.0系统可还原",
1288+
"name_en": "模拟cmd1.0系统可还原",
1289+
"desc": "如果不小心删了文件,可以用save和load保存系统或加载系统,文件名dosfile.txt,是json格式",
1290+
"desc_en": "如果不小心删了文件,可以用save和load保存系统或加载系统,文件名dosfile.txt,是json格式",
1291+
"category": "basic",
1292+
"file": "scripts/basic/cmd1_0_mnleeeta.py",
1293+
"thumbnail": null,
1294+
"version": 1,
1295+
"file_type": "py",
1296+
"author": "ioo",
1297+
"author_en": "ioo",
1298+
"tags": [
1299+
"community"
1300+
],
1301+
"requires": [],
1302+
"min_app_version": "1.5.0",
1303+
"added": "2026-04-05",
1304+
"updated": null,
1305+
"status": "active",
1306+
"lines": 97
12841307
}
12851308
]
12861309
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# 欢迎使用 PythonIDE!如果觉得好用,请给个好评哦~
2+
# cmd简练版
3+
R = "" # 红
4+
G = "" # 绿
5+
Y = "" # 黄
6+
B = "" # 蓝
7+
C = "" # 青
8+
M = "" # 紫
9+
X = ""
10+
new_l = "\n"
11+
import json
12+
cmd = ""
13+
show = ">"
14+
file={"command.com":"bin,can't see",
15+
"io.sys":"bin,can't see",
16+
"msdos.sys":"bin,can't see",
17+
"ms.txt":"hello user!",
18+
"sys.txt":"看到这个的人我祝福他幸福快乐每一天",
19+
"thank.xz":"敢看嘛,其实是感谢使用"
20+
}
21+
print("DOS改版")
22+
print("输入help以了解命令")
23+
while True:
24+
25+
cmd = input(show).strip() #del " "
26+
if not cmd == new_l:
27+
# help
28+
if cmd.startswith("help"):
29+
print("echo 打印文字,如echo hello")
30+
print("echo on 开启提示符,echo off 关闭提示符")
31+
print("dir显示文件")
32+
print("type显示文件内容")
33+
print("del可以删除文件,无需路径")
34+
print("我自定义了文件的写入方式")
35+
print("add file-text")
36+
print("new file name")
37+
print("exit 退出程序")
38+
print("(del如果显示文件名就是删除成功)")
39+
#echo
40+
elif cmd.startswith("echo"):
41+
input_str = cmd[4:].lstrip()
42+
if input_str.startswith("on"):
43+
show = ">"
44+
elif input_str.startswith("off"):
45+
show = ""
46+
else:
47+
print(input_str)
48+
# exit
49+
elif cmd == "exit":
50+
51+
exit()
52+
elif cmd=="dir":
53+
print("file:")
54+
55+
for i in list(file):
56+
print(" "+i)
57+
print("file number:"+str(len(file)))
58+
elif cmd == "oaoa":
59+
print("91*10086=917826")
60+
# 在命令判断里加一段
61+
elif cmd.startswith("cls"):
62+
for I in range(1145):
63+
print("\a")
64+
elif cmd.startswith("type"):
65+
print(file.get(cmd[5:],"无法找到此文件"))
66+
elif cmd.startswith("del"):
67+
if not cmd.endswith(".sys"):
68+
if file.pop(cmd[4:],False):
69+
70+
71+
72+
bool=True
73+
else:
74+
bool=False
75+
print("try del file:"+cmd[4:] if bool else "cannot find or del this file")
76+
elif cmd.startswith("add"):
77+
try:
78+
file[cmd[4:]]+=input(">>text")
79+
except:
80+
file[cmd[4:]]=input(">>text")
81+
elif cmd.startswith("new"):
82+
name=cmd[4:]
83+
text=input(">>text")
84+
file[name]=text
85+
elif cmd.startswith("format"):
86+
file={}
87+
exit()
88+
# read 命令
89+
elif cmd.startswith('load'):
90+
with open("dosfile.txt", "r", encoding="utf-8") as f:
91+
file = json.load(f)
92+
elif cmd.startswith("save"):
93+
with open("dosfile.txt", "w", encoding="utf-8") as f:
94+
json.dump(file, f, ensure_ascii=False, indent=2)
95+
else:
96+
print(f"'{cmd}' 不是内部或外部命令,也不是可运行的程序")

0 commit comments

Comments
 (0)