Windows 命令解释器在操作系统中的作用

Windows 命令解释器在操作系统中的作用,windows,operating-system,Windows,Operating System,我正在读关于操作系统的书。我了解到,当操作系统启动时,命令解释器作为用户进程启动,当您单击GUI元素(例如,应用程序的桌面符号)时,启动该应用程序的命令将传递给该命令解释器 我知道shell或cmd.exe形式的命令解释器。这是否意味着在Windows上,当我双击桌面图标(比如word)时,下面有一个命令解释器来处理这个命令?那么单击GUI元素就等于在cmd.exe中编写命令 在Windows下,进程资源管理器中显示的进程名称是什么?传统上,至少“命令解释器”一词仅指命令行解释器,如cmd.ex

我正在读关于操作系统的书。我了解到,当操作系统启动时,命令解释器作为用户进程启动,当您单击GUI元素(例如,应用程序的桌面符号)时,启动该应用程序的命令将传递给该命令解释器

我知道shell或cmd.exe形式的命令解释器。这是否意味着在Windows上,当我双击桌面图标(比如word)时,下面有一个命令解释器来处理这个命令?那么单击GUI元素就等于在cmd.exe中编写命令


在Windows下,进程资源管理器中显示的进程名称是什么?

传统上,至少“命令解释器”一词仅指命令行解释器,如
cmd.exe
,如果您以这种方式解释该短语,则声明是错误的。当界面是图形化的时,例如在Windows中,我们通常称它为“shell”

Windows shell在任务管理器中称为Explorer,
Explorer.exe

那么单击GUI元素就等于在cmd.exe中编写命令

它们是等价的,因为它们都具有大致相同的功能(允许用户与操作系统交互),但并不完全相同


特别要注意的是,资源管理器不是通过将命令传递给
cmd.exe来工作的,反之亦然。

传统上,至少“命令解释器”一词仅指命令行解释器,如
cmd.exe
,如果您这样解释该短语,则该说法是错误的。当界面是图形化的时,例如在Windows中,我们通常称它为“shell”

Windows shell在任务管理器中称为Explorer,
Explorer.exe

那么单击GUI元素就等于在cmd.exe中编写命令

它们是等价的,因为它们都具有大致相同的功能(允许用户与操作系统交互),但并不完全相同


特别要注意的是,资源管理器不是通过将命令传递给
cmd.exe来工作的,反之亦然。

传统上,至少“命令解释器”一词仅指命令行解释器,如
cmd.exe
,如果您这样解释该短语,则该说法是错误的。当界面是图形化的时,例如在Windows中,我们通常称它为“shell”

Windows shell在任务管理器中称为Explorer,
Explorer.exe

那么单击GUI元素就等于在cmd.exe中编写命令

它们是等价的,因为它们都具有大致相同的功能(允许用户与操作系统交互),但并不完全相同


特别要注意的是,资源管理器不是通过将命令传递给
cmd.exe来工作的,反之亦然。

传统上,至少“命令解释器”一词仅指命令行解释器,如
cmd.exe
,如果您这样解释该短语,则该说法是错误的。当界面是图形化的时,例如在Windows中,我们通常称它为“shell”

Windows shell在任务管理器中称为Explorer,
Explorer.exe

那么单击GUI元素就等于在cmd.exe中编写命令

它们是等价的,因为它们都具有大致相同的功能(允许用户与操作系统交互),但并不完全相同


特别要注意的是,资源管理器不是通过将命令传递给cmd.exe来工作的,反之亦然。

在linux中,命令解释器从用户那里获取命令,然后将该命令传递给内核。命令解释器在linux中也称为shell。在linux中有不同的shell,如bash,korn等…我已经实现了简单的c基本shell,如下所示

/*header*/
#include<stdio.h>
#include<string.h>
#include <signal.h>
#include<stdlib.h>

/*macros*/

/*maximum lenth of the line*/
#define LINE_MAX 10

/*function prototype*/
int getline1(char s[],int lim);

/*main*/
int main()
{
    char line[LINE_MAX];/*to store line*/
    int len;/*lenth of the input line*/

    /*clear the terminal*/
    system("clear");

    printf("************This is the C shell**********\n");
    printf("Enter ctrl+D to exit\n");

    /*calls the getline function to get input line*/
    while ((len = getline1(line, LINE_MAX)) > 0){

                /*if specified command is entered then execute it
         *else print command is not found 
         */
        if(!strcmp(line,"ls"))
            system("ls");

        else if(!strcmp(line,"pwd"))
            system("pwd");

        else if(!strcmp(line,"ifconfig"))
            system("ifconfig");

        else
            printf("Command is not found\n");
    }

    printf("Exiting from shell..\n");
    return(0);
}

/**
 * @brief getline1 gets the line from user
 * param [in] : s is string to store line
 * param [in] : lim is maximum lenth of the line
 *
 * @return 0 fail nonzero otherwise
 */
int getline1(char s[],int lim)
{
    /*c is to store the character and lenth is lenth of line*/
    int c, lenth;

    /*take the characters until EOF or new line is reached*/
    for (lenth = 0; lenth < lim-1 && (c=getchar()) != EOF && c!='\n' ; ++lenth)
            s[lenth] = c;

    /*count the new line character*/
    if(s[0] == '\n')
        lenth++;

    /*assign null at end*/
    s[lenth] = '\0';

    /*return lenth of the line*/
    return lenth;

}
/*标题*/
#包括
#包括
#包括
#包括
/*宏*/
/*线的最大长度*/
#定义线_最大值10
/*功能原型*/
int getline1(字符s[],int lim);
/*主要*/
int main()
{
字符行[line_MAX];/*用于存储行*/
int len;/*输入行的长度*/
/*清除终端*/
系统(“清除”);
printf(“*************这是C shell************\n”);
printf(“输入ctrl+D以退出\n”);
/*调用getline函数以获取输入行*/
而((len=getline1(line,line_MAX))>0){
/*如果输入了指定的命令,则执行该命令
*未找到else print命令
*/
如果(!strcmp(行,“ls”))
系统(“ls”);
否则,如果(!strcmp(第行,“pwd”))
系统(“pwd”);
如果(!strcmp(第行,“ifconfig”))
系统(“ifconfig”);
其他的
printf(“未找到命令\n”);
}
printf(“退出shell..\n”);
返回(0);
}
/**
*@brief getline1从用户处获取该行
*param[in]:s是存储行的字符串
*param[in]:lim是直线的最大长度
*
*@return 0失败,否则为非零
*/
int getline1(字符s[],int lim)
{
/*c是存储字符,lenth是行的lenth*/
int c,lenth;
/*获取字符,直到达到EOF或新行*/
对于(lenth=0;lenth
在linux中,命令解释器从用户那里获取命令,然后将该命令传递给内核。命令解释器在linux中也称为shell。linux中有不同的shell,如bash、korn等。我实现了简单的c base shell,如下所示

/*header*/
#include<stdio.h>
#include<string.h>
#include <signal.h>
#include<stdlib.h>

/*macros*/

/*maximum lenth of the line*/
#define LINE_MAX 10

/*function prototype*/
int getline1(char s[],int lim);

/*main*/
int main()
{
    char line[LINE_MAX];/*to store line*/
    int len;/*lenth of the input line*/

    /*clear the terminal*/
    system("clear");

    printf("************This is the C shell**********\n");
    printf("Enter ctrl+D to exit\n");

    /*calls the getline function to get input line*/
    while ((len = getline1(line, LINE_MAX)) > 0){

                /*if specified command is entered then execute it
         *else print command is not found 
         */
        if(!strcmp(line,"ls"))
            system("ls");

        else if(!strcmp(line,"pwd"))
            system("pwd");

        else if(!strcmp(line,"ifconfig"))
            system("ifconfig");

        else
            printf("Command is not found\n");
    }

    printf("Exiting from shell..\n");
    return(0);
}

/**
 * @brief getline1 gets the line from user
 * param [in] : s is string to store line
 * param [in] : lim is maximum lenth of the line
 *
 * @return 0 fail nonzero otherwise
 */
int getline1(char s[],int lim)
{
    /*c is to store the character and lenth is lenth of line*/
    int c, lenth;

    /*take the characters until EOF or new line is reached*/
    for (lenth = 0; lenth < lim-1 && (c=getchar()) != EOF && c!='\n' ; ++lenth)
            s[lenth] = c;

    /*count the new line character*/
    if(s[0] == '\n')
        lenth++;

    /*assign null at end*/
    s[lenth] = '\0';

    /*return lenth of the line*/
    return lenth;

}
/*标题*/
#包括
#包括
#包括
#包括
/*宏*/
/*线的最大长度*/
#定义线_最大值10
/*功能原型*/
int getline1(字符s[],int lim);
/*主要*/
int main()
{