《dos系统指令实验报告》由会员分享,可在线阅读,更多相关《dos系统指令实验报告(3页珍藏版)》请在金锄头文库上搜索。
1、I1实验一、实验一、DOS 系统指令系统指令一、一、实验目的实验目的(1)掌握命令解释程序的原理;(2)掌握简单的 DOS 调用方法;(3)掌握 C 语言编程初步。二、二、实验内容和要求实验内容和要求编写类似于 DOS,UNIX 的命令行解释程序(1)自行定义系统提示符(2)自定义命令集(8-10 个)(3)用户输入 HELP 以查找命令的帮助(4)列出命令的功能,区分内部还是外部命令(5)用户输入 QUIT 退出(6)查看 DOS 常用的内部命令(至少 8 个) 。根据教师指定的实验课题,完成设计、编码、测试工作。三、三、实验方法、步骤及结果测试实验方法、步骤及结果测试1. 原理分析及流程图
2、原理分析及流程图 利用数组存储指令,主要使用判断语句,switch. .case 语句。 2. 主要程序段及其解释:主要程序段及其解释: 实现主要功能的程序段,重要的是程序的注释解释。 #include #include void main() char *b11=“dir“,“find“,“md“,“del“,“cls“,“date“,“time“,“ren“,“copy“,“help“, “quit“; int pan(char ch1,char *j11);char a10,*p=a;printf(“Welcome.nPleas enter a command!nEnter quit t
3、o quit.nFor help,Enter help.n“); c1: printf(“c:“);scanf(“%s“,a);pan(p,b); if(strcmp(a,b10)!=0) goto c1;else printf(“out of work!n“);I2int pan(char ch1,char *j11) int i;for( i=0;i11;i+)if(strcmp(ch1,ji)=0) switch(i)case 0:printf(“nThiss function is list file.nIts an internal command.nVolume in drive
4、K gas no label.nVolume Serial Number is 60F0- 6C24nn“);break;case 1:printf(“nThiss function is find the words in files.nIts an internal command.n“);break;case 2:printf(“nThiss function is creat a new directory.nIts an internal command.n“);break;case 3:printf(“nThiss function is delete more than file
5、s.nIts an internal command.n“);break;case 4:printf(“nThiss function is clean screennIts an internal command.n“);break;case 5:printf(“nThiss function is show date.nIts an internal command.n“);break;case 6:printf(“nThiss function is shio time.nIts an internal command.n“);break;case 7:printf(“nThiss fu
6、nction is rename a file.nIts an internal command.n“);break;case 8:printf(“nThiss function is copy files.nIts an internal command.n“);break;case 9:printf(“dirtfindtmdtdeltclsndatettimetrentcopynEnter “ quit“ to quit this program!n“);break;case 10:printf(“Thanks for using it,bye!n“);break;return 1;printf(“THIS ONE IS NOT A INTERNAL COMMAND!n“);return 0; 3. 运行结果及分析运行结果及分析I3四、四、实验总结实验总结理论跟实际操作有很大的区别,将理论知识正确的应用很有难度。结构体 和多文件结构不能很好的应用。下次要更加积极的参与团队的讨论,争取更好 的完成任务。