121
个编辑
MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针。
如果在编辑的过程中遇到了什么问题,可以去讨论板提问。
为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证。
MCBBS Wiki GitHub群组已上线!
您可以在回声洞中发表吐槽!
服务器状态监控。点击进入
本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>
(→程序源代码) |
|||
(未显示2个用户的6个中间版本) | |||
<
#-*- coding:utf-8 -*-
#导出模块
import sys, os, webbrowser, codecs, time, datetime
from ctypes import *
version_number = "
#定义一堆函数
def cls():
import os
f_handler=open('out.log', 'w')
oldstdout = sys.stdout
sys.stdout=f_handler
os.system('cls')
def msg():
msg = input("[input]请输入消息:")
print(msg)
def openurl():
url = input("[input]请输入要打开的网页URL:")
webbrowser.open(url)
print("已打开网页", url)
def printversion():
print("Version:", version_number)
def openexe():
flie = input("请输入要打开的可执行文件名:")
if flie == "":
print("[ERROR]FlieError:文件名错误")
else:
print("已打开可执行文件", flie)
os.system(flie)
def printdate():
cur=datetime.datetime.now()
cur.hour
cur.minute
cur.year
cur.day
cur.month
i = datetime.datetime.now()
print ("当前的日期和时间是 %s" % i)
print ("ISO格式的日期和时间是 %s" % i.isoformat() )
print ("当前的年份是 %s" %i.year)
print ("当前的月份是 %s" %i.month)
print ("当前的日期是 %s" %i.day)
print ("dd/mm/yyyy 格式是 %s/%s/%s" % (i.day, i.month, i.year) )
print ("当前小时是 %s" %i.hour)
print ("当前分钟是 %s" %i.minute)
print ("当前秒是 %s" %i.second)
def shlmsg():
user32 = windll.LoadLibrary('user32.dll')
shellmsg = input("请输入要使用 Python Shell 显示的消息:")
print("已使用 Python Shell 显示消息", shellmsg)
user32.MessageBoxA(0, str.encode(shellmsg), str.encode('Python Shell'), 0)
def restart():
python = sys.executable
#显示欢迎语句
print("欢迎使用pycmd!")
printversion()
#控制台主循环
while True:
choose = input("Pycmd_Admin>")
if choose == "^Z":
sys.exit()
elif choose == "exit()":
sys.exit()
elif choose == "exit":
print("[ERROR]SyntaxError:'exit'已弃用,请使用'exit()'")
elif choose == "msg":
msg()
elif choose == "cls":
cls()
elif choose == "url":
openurl()
elif choose == "version":
printversion()
elif choose == "exe":
openexe()
elif choose == "shlmsg":
shlmsg()
elif choose == "cmd":
print("已打开 cmd ")
os.system("cmd")
elif choose == "powershell":
print("已打开 PowerShell")
os.system("PowerShell")
elif choose == "python":
print("已打开 Python")
os.system("python")
elif choose == "reset":
restart()
elif choose == "explorer":
os.system("explorer")
print("已打开 文件资源管理器")
elif choose == "date":
printdate()
elif choose == "":
continue
else:
print("[ERROR]SyntaxError:未知的命令:'" + choose + "'")
</
('''艹!!!!!'''源代码炸了!!!)
==程序可执行文件==
==更新和优化==
这个项目已经咕了
===更新记录===
*V1.2, 增加了查看时间的命令"date"。
===bug清单===
*pyc_1:有几率在启动时不显示任何文字,需重启控制台。
*pyc_2:有几率不显示光标<s>强迫症杀手</s>。
*pyc_3:当输入的可执行文件名无意义时,仍会显示“已打开可执行文件 xxx”。
**已知是python特性。
*pyc_4:当打开cmd或powershell时,会在关闭后才显示“已打开cmd/powershell”。
**现已修复。
==须知==
这是一个'''开源项目'''。
<s>但是谁会闲的没事去研究源代码?</s>
|
个编辑