Skip to content

Commit bac9006

Browse files
投稿: 模拟cmd2.5 — by ioo
1 parent 4ce08fc commit bac9006

2 files changed

Lines changed: 169 additions & 2 deletions

File tree

script_library/index.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"format_version": 1,
3-
"data_version": 95,
4-
"updated": "2026-04-17T18:24:51.985Z",
3+
"data_version": 96,
4+
"updated": "2026-04-17T20:51:59Z",
55
"announcement": null,
66
"categories": [
77
{
@@ -1654,6 +1654,30 @@
16541654
"updated": null,
16551655
"status": "active",
16561656
"lines": 26
1657+
},
1658+
{
1659+
"id": "community_模拟cmd25__by_ioo",
1660+
"name": "模拟cmd2.5 — by ioo",
1661+
"name_en": "模拟cmd2.5 — by ioo",
1662+
"desc": "[投稿] 模拟cmd2.5 — by ioo",
1663+
"desc_en": "[投稿] 模拟cmd2.5 — by ioo",
1664+
"category": "basic",
1665+
"file": "scripts/basic/cmd2_5_mo2zcg31.py",
1666+
"thumbnail": null,
1667+
"version": 1,
1668+
"file_type": "py",
1669+
"author": "社区投稿",
1670+
"author_en": "社区投稿",
1671+
"tags": [
1672+
"community",
1673+
"basic"
1674+
],
1675+
"requires": [],
1676+
"min_app_version": "1.5.0",
1677+
"added": "2026-04-17",
1678+
"updated": null,
1679+
"status": "active",
1680+
"lines": 143
16571681
}
16581682
]
16591683
}
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# 欢迎使用 PythonIDE!如果觉得好用,请给个好评哦~
2+
# cmd简练版
3+
R = "" # 红
4+
G = "" # 绿
5+
Y = "" # 黄
6+
B = "" # 蓝
7+
C = "" # 青
8+
M = "" # 紫
9+
X = ""
10+
11+
copy=""
12+
import os
13+
import dialogs
14+
import time
15+
def load():
16+
t="█"
17+
for i in range(51):
18+
if i*2<30:
19+
types=R
20+
elif i*2>30 and i*2<60:
21+
types=Y
22+
elif i*2>60:
23+
types=G
24+
print(f"\r|{types}{i * t}{X}|{(49 - i) * '-'}{i*2}%", end="\033[A")
25+
time.sleep(0.01)
26+
new_l = "\n"
27+
import json
28+
cmd = ""
29+
show = ">"
30+
file={"command.com":"bin,can't see",
31+
"io.sys":"bin,can't see",
32+
"msdos.sys":"bin,can't see",
33+
"ms.txt":"hello user!",
34+
"sys.txt":"看到这个的人我祝福他幸福快乐每一天",
35+
"thank.xz":"敢看嘛,其实是感谢使用"
36+
}
37+
print("DOS改版")
38+
print("输入help以了解命令")
39+
while True:
40+
41+
cmd = input(show).strip() #del " "
42+
if not cmd == new_l:
43+
# help
44+
if cmd.startswith("help"):
45+
print("echo 打印文字,如echo hello")
46+
print("echo on 开启提示符,echo off 关闭提示符")
47+
print("dir显示文件")
48+
print("type显示文件内容")
49+
print("del可以删除文件,无需路径")
50+
print("我自定义了文件的写入方式")
51+
print("add file-text")
52+
print("new file name")
53+
print("exit 退出程序")
54+
print("alert text")
55+
print("(del如果显示文件名就是删除成功)")
56+
#echo
57+
elif cmd.startswith("echo"):
58+
input_str = cmd[4:].lstrip()
59+
if input_str.startswith("on"):
60+
show = ">"
61+
elif input_str.startswith("off"):
62+
show = ""
63+
else:
64+
print(input_str)
65+
# exit
66+
elif cmd == "exit":
67+
exit()
68+
elif cmd=="dir":
69+
print("file:")
70+
71+
for i in list(file):
72+
B=float('%.2f'%(len(str(file[i]))/1024))
73+
leng=32-len(str(i))
74+
print(f"- {i}"+f'%{leng}s'%(f'{B}KB'))
75+
print("file number:"+str(len(file)))
76+
elif cmd == "oaoa":
77+
print("91*10086=917826")
78+
# 在命令判断里加一段
79+
elif cmd.startswith("cls"):
80+
for I in range(1):
81+
print("\a")
82+
elif cmd.startswith("type"):
83+
print(file.get(cmd[5:],"无法找到此文件"))
84+
elif cmd.startswith("del "):
85+
if not cmd.endswith(".sys"):
86+
if file.pop(cmd[4:],False):
87+
kakimi="jsjsjjzzkafjzlyrzkxyf"
88+
#上面这个string是猫踩的
89+
#处理误删文件
90+
bool=True
91+
else:
92+
bool=False
93+
print("try del file:"+cmd[4:] if bool else "cannot find or del this file")
94+
elif cmd.startswith("add"):
95+
try:
96+
file[cmd[4:]]+=input("text>")
97+
except:
98+
file[cmd[4:]]=input("text>")
99+
elif cmd.startswith("new"):
100+
name=cmd[4:]
101+
text=input("text>")
102+
file[name]=text
103+
elif cmd.startswith("format"):
104+
file={}
105+
exit()
106+
# read 命令
107+
elif cmd.startswith('load'):
108+
print("loading...")
109+
load()
110+
print("\n")
111+
with open("dosfile.json", "r", encoding="utf-8") as f:
112+
file = json.load(f)
113+
elif cmd.startswith("save"):
114+
print("saving...")
115+
load()
116+
print("\n")
117+
with open("dosfile.json", "w", encoding="utf-8") as f:
118+
json.dump(file, f, ensure_ascii=False, indent=2)
119+
elif cmd.startswith("ui"):
120+
if dialogs.list_dialog("选择一个操作",["continue"])=="continue":
121+
continue
122+
else:
123+
continue
124+
elif cmd.startswith("delt"):
125+
inp=input("此操作可能会影响到你的文件,是否继续(n/y)")
126+
if inp=="y":
127+
try:
128+
os.remove(cmd[5:])
129+
print("成功")
130+
except:
131+
print("失败")
132+
continue
133+
elif cmd.startswith("alert"):
134+
dialogs.alert(cmd[6:])
135+
elif cmd.startswith("input"):
136+
copy=dialogs.input_alert(cmd[6:])
137+
elif cmd=="copy":
138+
print(copy)
139+
elif cmd="others":
140+
print("呜呜呜要期中了下载一下吧")
141+
else:
142+
dialogs.alert(f"'{cmd}' 不是内部或外部命令,也不是可运行的程序")
143+

0 commit comments

Comments
 (0)