Instruction processing method and device, electronic equipment and storage medium

By configuring temporary environment variables to directly use the new version in application version switching, the problem of poor flexibility in version switching is solved, efficiency and flexibility are improved, and unnecessary uninstallation and installation operations are reduced.

CN118656109APending Publication Date: 2024-09-17MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410242324.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-01
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

During the application version switching process, the existing technology has poor flexibility and requires uninstalling the old version and installing the new version, resulting in low efficiency.

Method used

By obtaining the version switching command, if the pre-stored installation address information contains the target version number, configure the temporary environment variable of the target terminal window. When receiving the preset command, execute the command according to the temporary environment variable to avoid uninstalling the old version file and directly use the new version.

Benefits of technology

It improves the efficiency and flexibility of version switching, simplifies the operation process, and reduces repeated uninstallation and installation operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656109A
    Figure CN118656109A
Patent Text Reader

Abstract

The embodiment of the invention provides an instruction processing method and device, electronic equipment and a storage medium. The method comprises the steps that a version switching instruction for an application program is acquired; the version switching instruction comprises a target version number; if the pre-stored installation address information comprises a first installation address of the application program with the target version number, configuring a temporary environment variable of a target terminal window according to the first installation address; and when the target terminal window receives a preset instruction, executing the preset instruction according to the temporary environment variable. Therefore, the flexibility of version switching can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to an instruction processing method, device, electronic device and storage medium. Background Art

[0002] With the development of electronic technology, the development requirements of applications are becoming more and more diverse. Considering that different versions of development applications will affect the compatibility of the projects to be developed, developers often need to switch the versions of development applications according to the personalized needs of different projects. In the actual development process, the newer the version of the development application, the better.

[0003] In the process of version switching, if the old version of the development application is uninstalled and the new version of the development application is downloaded and installed, the flexibility of switching versions will be poor. Therefore, the problem of how to improve the flexibility of switching versions has received much attention. Summary of the invention

[0004] The embodiments of the present application provide an instruction processing method, device, electronic device and storage medium to improve the flexibility of switching versions.

[0005] In a first aspect, an embodiment of the present application provides an instruction processing method, including:

[0006] Obtaining a version switching instruction for an application; the version switching instruction includes a target version number;

[0007] If the pre-stored installation address information includes the first installation address of the application program of the target version number, configuring the temporary environment variables of the target terminal window according to the first installation address;

[0008] When the target terminal window receives a preset instruction, the preset instruction is executed according to the temporary environment variable.

[0009] In a second aspect, an embodiment of the present application provides an instruction processing device, including:

[0010] An acquisition unit, configured to acquire a version switching instruction for an application program; the version switching instruction includes a target version number;

[0011] a configuration unit, configured to configure a temporary environment variable of a target terminal window according to the first installation address if the pre-stored installation address information includes a first installation address of the application program of the target version number;

[0012] An execution unit is used to execute the preset instruction according to the temporary environment variable when the preset instruction is received in the target terminal window.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory configured to store computer-executable instructions, wherein the computer-executable instructions, when executed, cause the processor to execute the instruction processing method described in the first aspect.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium for storing computer-executable instructions, which, when executed by a processor, implement the instruction processing method as described in the first aspect.

[0015] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the instruction processing method described in the first aspect.

[0016] It can be seen that in the embodiment of the present application, first, a version switching instruction for the application is obtained; the version switching instruction includes the target version number; if the pre-stored installation address information includes the first installation address of the application with the target version number, the temporary environment variable of the target terminal window is configured according to the first installation address; when the target terminal window receives the preset instruction, the preset instruction is executed according to the temporary environment variable. In this way, considering that in the target terminal window, the temporary environment variable will take precedence over the global environment variable to take effect, by configuring the temporary environment variable of the target terminal window according to the first installation address of the application with the target version number, the target terminal window can start the application with the target version number through the temporary environment variable to execute the preset instruction when receiving the preset instruction of the application, instead of executing the preset instruction by starting the application with the historical version number before the version switching. In addition, the switching version actually only needs to configure the temporary environment variable that takes effect in the target terminal window, and does not need to uninstall the old version file, which simplifies unnecessary repeated uninstallation and repeated installation operations, and improves the efficiency and flexibility of version switching. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.

[0018] Figure 1 A schematic diagram of an implementation environment of an instruction processing method provided in an embodiment of the present application;

[0019] Figure 2 A processing flow chart of an instruction processing method provided in an embodiment of the present application;

[0020] Figure 3 A processing flow chart of another instruction processing method provided in an embodiment of the present application;

[0021] Figure 4 A schematic diagram of an instruction processing device provided in an embodiment of the present application;

[0022] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0024] This specification provides an instruction processing method embodiment:

[0025] In application development scenarios, different development projects have personalized compatibility requirements. Therefore, developers may need to switch versions of development applications when working on different development projects. During the version switching process, developers often need to uninstall the old version files and download and install the new version files.

[0026] However, the newer the application is, the better it is. For example, a developer may use a first version of the application for a period of time, then use a second version of the application for a period of time, and then switch back to the first version of the application for a period of time. When switching versions, the old version files that are uninstalled may need to be reinstalled after a period of time, so the above version switching method has poor flexibility.

[0027] Therefore, in order to solve the above problems, an embodiment of the present application provides an instruction processing method.

[0028] The instruction processing method provided in one or more embodiments of this specification may be applicable to the implementation environment of the instruction processing method, such as Figure 1 As shown, the implementation environment at least includes a server 101 for processing instructions.

[0029] The server 101 may be a single server, or a server cluster consisting of a plurality of servers, or one or more cloud servers in a cloud computing platform, for processing instructions.

[0030] In the implementation environment, during the process of processing the instruction, the server 101 first obtains the version switching instruction for the application; the version switching instruction includes the target version number; if the pre-stored installation address information includes the first installation address of the application with the target version number, the temporary environment variable of the target terminal window is configured according to the first installation address; when the target terminal window receives the preset instruction, the preset instruction is executed according to the temporary environment variable. In this way, considering that in the target terminal window, the temporary environment variable will take precedence over the global environment variable to take effect, by configuring the temporary environment variable of the target terminal window according to the first installation address of the application with the target version number, the target terminal window can start the application with the target version number through the temporary environment variable to execute the preset instruction when receiving the preset instruction of the application, instead of executing the preset instruction by starting the application with the historical version number before the version switching. In addition, the switching version actually only needs to configure the temporary environment variable that takes effect in the target terminal window, and does not need to uninstall the old version file, which simplifies the unnecessary repeated uninstallation and repeated installation operations, and improves the efficiency and flexibility of version switching.

[0031] Figure 2 A processing flow chart of an instruction processing method provided in an embodiment of the present application. Figure 2 The instruction processing method provided in this embodiment specifically includes steps S202 to S206.

[0032] The instruction processing method provided in this embodiment can be implemented by a pre-written script file, that is, the instruction processing method provided in this embodiment is executed by executing the script file.

[0033] Exemplarily, the script file may be a Bash script.

[0034] Bash script is a scripting language used in operating systems. It can execute a series of commands to implement logic and functions. It is an important part of the software development process.

[0035] Step S202, obtaining a version switching instruction for the application; the version switching instruction includes a target version number.

[0036] In a specific implementation, obtaining the version switching instruction for the application program may include intercepting the version switching instruction for the application program received by the target terminal window.

[0037] A terminal window is an interface in a computer operating system that allows users to operate at the command line. It is part of the operating system and is usually accessible through shortcut keys or in the Start menu. In a terminal window, users can enter commands, execute programs, and access the file system. A terminal window may also be called a command line window, command line terminal, or console window.

[0038] Regarding the terminal window, developers can open the terminal window and execute commands to operate the computer. When front-end personnel develop multiple projects in parallel, they need to open multiple terminal windows, and the processes of each terminal window are independent of each other.

[0039] The target terminal window can be a running terminal window.

[0040] The application program may be an application program of which at least one version has been installed in the user terminal that executes the instruction processing method provided in this embodiment.

[0041] The application can be a development application, it can be a communication application, it can be a transaction application, and so on.

[0042] The user terminal may pre-install an application with a historical version number.

[0043] For example, a Node.exe software is pre-installed in the computer, and the version number of the Node.exe software is v18, that is, the historical version number is v18.

[0044] The global environment variables of the user terminal may be configured with a mapping relationship between the second installation address of the application with the historical version number and the application's operation instruction set, or may be configured with a mapping relationship between the second installation address of the application with the historical version number and the operation instructions in the application's operation instruction set.

[0045] The number of operation instructions of the application program may be one or more.

[0046] In the mapping relationship between the application installation address of the historical version number and the operation instruction in the operation instruction set of the application, the operation instruction points to the second installation address.

[0047] For example, the application program's operation instruction set A includes: operation instruction 1, operation instruction 2, and operation instruction 3. The global environment variable includes: operation instruction 1 -> second installation address, operation instruction 2 -> second installation address, operation instruction 3 -> second installation address. Alternatively, the global environment variable includes: operation instruction set A -> second installation address.

[0048] Considering that the operating system on the user terminal only recognizes a part of the built-in commands by default, if you want the operating system to recognize custom commands, such as the node command, you need to configure the global environment variables to point the custom command to the corresponding application installation address, so that when the custom command is received, the application in the application installation address corresponding to the custom command is started to execute the custom command.

[0049] Node.js is a free, open source, cross-platform JavaScript runtime environment that allows developers to write command-line tools and server-side scripts outside of the browser. JavaScript is a lightweight, interpreted or just-in-time compiled programming language with function priority. The Node.js application is the aforementioned Node.exe. The node command is the executable operation instruction of the Node.exe.

[0050] The purpose of configuring the above mapping relationship in the global environment variable is that when any terminal window receives any operation instruction of an application, the second installation address of the application with the historical version number is used as the application search path, the executable program is searched according to the application search path, and the executable program is run to execute the operation instruction.

[0051] For example, the global environment variable is configured with node-> / nodejs / node.exe, "node" is used to represent the operation instruction of the development application Node.exe, and " / nodejs / node.exe" is used to represent the second installation address of the v18 version of the application. When a node command is received in a terminal window, " / nodejs / node.exe" is used as the application search path based on the global environment variable, and then the v18 version of the development application Node.exe is searched according to the application search path to execute the node command.

[0052] In the case where the target terminal window uses the application with a historical version number by default, the version switching instruction for the application can be used to switch the application with the historical version number used by the target terminal window to the application with the target version number.

[0053] The historical version number is the version number before the application is switched to another version, and the target version number is the version number after the application is switched to another version.

[0054] Next, taking the application development scenario as an example, the application scenario of the version switching operation is explained exemplarily:

[0055] Front-end developers need to frequently switch the Node.js software version installed on their computers to be compatible with the development requirements of various projects.

[0056] Specifically, the front-end developer pre-installs a Node.exe software in the computer, and the version is v18, so the basic operating environment on the computer is v18. The front-end developer opens the terminal window and uses Node.exe through the command line. Because Node.exe does not have pages like other software, it can be said that the terminal window is a daily tool for front-end developers. Every time the front-end developer opens the terminal window, he executes the command "node-v" to query the version number, and the node version obtained is v18. If the front-end developer wants to switch the version to other node versions, for example, v16, it can be achieved through the instruction processing method provided in this embodiment. In the implementation process, the version switching instruction for the application Node.exe can be "ms node 16", where the target version number is "16".

[0057] Step S204: If the pre-stored installation address information includes the first installation address of the application program of the target version number, a temporary environment variable of the target terminal window is configured according to the first installation address.

[0058] In specific implementation, a query process can be performed in the pre-stored installation address information according to the target version number to obtain a query result of the target version number. If the query result of the target version number indicates that the installation address information includes the first installation address of the application of the target version number, a temporary environment variable of the target terminal window is configured according to the first installation address, and the temporary environment variable may include a mapping relationship between the first installation address and an operation instruction in the operation instruction set of the application.

[0059] In the first installation address and the second installation address, "first" and "second" are used to distinguish the installation addresses of the two version numbers of the application program and have no actual meaning. The first installation address is different from the second installation address.

[0060] The pre-stored installation address information may include the installation addresses of one or more version numbers of application programs installed on the user terminal.

[0061] The query result of the target version number is obtained by querying the pre-stored installation address information according to the target version number. The query result can be obtained by querying whether the installation address of one or more version numbers of applications installed by the user terminal includes the first installation address of the application with the target version number.

[0062] When the query result indicates that the installation address information includes the installation address of the target version application, it means that the user terminal has installed the target version application. Then, the temporary environment variable of the target terminal window can be configured according to the first installation address of the target version application.

[0063] To configure a temporary environment variable, you can either create a new temporary environment variable in the target terminal window or modify an existing temporary environment variable in the target terminal window.

[0064] The configuration of temporary environment variables is implemented through the underlying operating system. For example, in Windows, the set path command can be used to configure temporary environment variables, and in Mac, the export command can be used to configure temporary environment variables.

[0065] The temporary environment variable includes a mapping relationship between a first installation address of an application program of a target version number and an operation instruction in an operation instruction set of the application program, wherein the operation instruction in the mapping relationship points to the first installation address.

[0066] By configuring the mapping relationship in the temporary key variable, it is not necessary to uninstall applications with historical version numbers during the version switching process, and the installation addresses of applications with multiple version numbers can be retained in the user terminal, which improves the flexibility of version switching and simplifies unnecessary repeated uninstallation and repeated installation operations.

[0067] It should be noted that step S204 is not a manual operation, but is executed by a pre-written script, and the user who issues the version switching instruction cannot see the command for configuring the temporary environment variables in the target terminal window.

[0068] Exemplarily, the display area of ​​the target terminal window is as follows:

[0069] $ node -v

[0070] V18.12.0

[0071] $ms node 16

[0072] Info detects that the local version exists, the switch is successful, the node version is v16.19.0, and it is only valid in the current window

[0073] $ node -v

[0074] v16.19.0

[0075] In the above multiple command lines, "$node-v" is used to query the current node version of the terminal window. "V18.12.0" is used to indicate the complete historical version number. "$ms node 16" is the version switching instruction, which is used to indicate that the current node version of the target terminal window is switched to version 16, and version 16 has a unique corresponding complete target version number. The "Info" command line includes a description text of the execution status of the version switching instruction, which is used for users to better understand the execution status of the version switching instruction. "v16.19.0" is used to indicate the unique complete target version number corresponding to version 16.

[0076] In a specific implementation manner, the temporary environment variable becomes invalid after the target terminal window is closed.

[0077] A temporary environment variable is valid only in the terminal window where it is created. For example, if a temporary environment variable is created in a target terminal window, the temporary environment variable is valid only in the target terminal window and cannot be used in other terminal windows.

[0078] Temporary environment variables have priority over global environment variables. Specifically, when no temporary environment variables are created in the target terminal window, global environment variables are used by default. When temporary environment variables are created in the target terminal window, both environment variables include mapping relationships related to the application's operating instructions. When a conflict occurs between the temporary environment variables and the global environment variables, the temporary environment variables take effect and the global environment variables do not take effect.

[0079] By configuring temporary environment variables, once the target terminal window is closed, the temporary environment variables of the target terminal window will become invalid. When a new terminal window is reopened, the application with the historical version number configured in the global environment variable will still be used. The version switching in one terminal window will not affect another terminal window. Different terminal windows can use different versions of applications, making version switching more flexible.

[0080] In a specific implementation method, temporary environment variables of a target terminal window are configured according to a first installation address, including: copying global environment variables; the global environment variables include a mapping relationship between a second installation address of an application with a historical version number and an operation instruction in an operation instruction set of the application and preset environment parameters; replacing the mapping relationship between the copied second installation address and the operation instruction of the application with the first installation address to obtain a mapping relationship between the first installation address and the operation instruction of the application; and adding the mapping relationship between the first installation address and the operation instruction of the application and the copied preset environment parameters to the temporary environment variables of the target terminal window.

[0081] By copying the global environment variables, the mapping relationship between the second installation address of the application with the historical version number and the operation instructions in the operation instruction set of the application can be obtained, that is, the mapping relationship between the second installation address and the operation instructions of the application. By copying the global environment variables, the preset environment parameters can also be obtained.

[0082] The mapping relationship between the second installation address of the application with the copied historical version number and the operation instructions in the operation instruction set of the application is replaced by the first installation address to obtain the mapping relationship between the first installation address of the application with the target version number and the operation instructions in the operation instruction set of the application, that is, the mapping relationship between the first installation address and the operation instructions of the application.

[0083] For example, the global environment variable is configured with node-> / nodejs18 / node.exe, "node" is used to represent the operation instruction of the development application Node.exe, and " / nodejs18 / node.exe" is used to represent the second installation address of the v18 version of the application. In the mapping relationship between the operation instruction of the development application Node.exe and the second address of the v18 version of the application installation, the operation instruction points to the second installation address.

[0084] The first installation address of the target version number application is " / nodejs16 / node.exe". The copied node-> / nodejs18 / node.exe is replaced by " / nodejs16 / node.exe" to obtain node-> / nodejs16 / node.exe. In the mapping relationship between the operation instruction of the development application Node.exe and the first installation address of the v16 version application, the operation instruction points to the first installation address.

[0085] When the mapping relationship between the first installation address of the application with the target version number and the operation instruction in the operation instruction set of the application is added to the temporary environment variable of the target terminal window, the temporary environment variable conflicts with the global environment variable. During the operation of the target terminal window, the mapping relationship between the first installation address and the operation instruction of the application in the temporary environment variable takes effect, and the mapping relationship between the second installation address of the application with the historical version number in the global environment variable and the operation instruction in the operation instruction set of the application does not take effect. After configuring the temporary environment variable to modify the mapping relationship, the application with the historical version number does not need to be uninstalled when switching the version of the application, which simplifies unnecessary repeated uninstallation and repeated installation operations and improves the flexibility of switching versions.

[0086] The preset environment parameters may be part of the parameters manually configured during the process of configuring the global environment variables. Considering that the global environment variables are not modified during the implementation of the instruction processing method provided in this embodiment, and there is no need to uninstall the application with the historical version number, the installation addresses of the application with multiple version numbers can be retained at the same time, and thus, the preset environment parameters used by the application with the historical version number are also retained.

[0087] In the process of configuring the temporary environment variables of the target terminal window, by adding the copied preset environment parameters to the temporary environment variables of the target terminal window, the preset environment parameters can be reused, thereby simplifying repeated manual configuration operations.

[0088] In a specific implementation, after obtaining the version switching instruction for the application and before executing the preset instruction according to the temporary environment variable, the instruction processing method also includes: if the installation address information does not include the first installation address, downloading and installing the corresponding version of the application according to the target version number; obtaining the first installation address; and configuring the temporary environment variables of the target terminal window according to the first installation address.

[0089] If the installation address information does not include the first installation address of the target version application, it means that the user terminal has not installed the target version application. Then, the target version application can be downloaded first, and then the temporary environment variables of the target terminal window can be configured.

[0090] Before downloading the target version of the application, you can pre-install the preset tools in the preset tool package.

[0091] Exemplarily, the preset tool package may be an NPM (Node Package Manager, Nodejs package management tool) function package. Specifically, to download the target version number of the application, the tool ms-cli in the NPM package needs to be used. The installation of the tool ms-cli in the NPM package can be achieved by running a Bash script to point to the following command in the target terminal window: npminstallms-cli. This command can be used to download the tool ms-cli to the local user terminal and install it.

[0092] When receiving the version switching instruction, the Bash script can check whether the target version of the application has been downloaded. If the target version of the application has not been downloaded, the Bash script will call the JS (Javascript, a translated scripting language) code in the NPM package to execute the download logic and cache it to the specified installation address. The Bash script calling the JS code in the NPM package refers to the Bash script calling the tool ms-cli in the NPM package.

[0093] In addition, considering that the instruction processing method provided in this embodiment does not need to uninstall the application with the historical version number, the toolkit downloaded to the installation directory of the application with the historical version number during the use of the application with the historical version number in the target terminal window or other terminal windows outside the target terminal window can also be retained, which is conducive to the reuse of the toolkit.

[0094] After calling the preset tool in the preset toolkit to download the target version number application to the specified installation address, the first installation address is obtained, and the aforementioned specified installation address can be used as the first installation address of the target version number application.

[0095] The target version number corresponds to the version of the application, that is, the target version number of the application.

[0096] It should be noted that, downloading and installing the corresponding version of the application according to the target version number; obtaining the first installation address; configuring the temporary environment variables of the target terminal window according to the first installation address, the above steps are not manually operated, but are executed by pre-written scripts. The user who issues the version switching instruction cannot see the commands used to execute the above steps in the target terminal window.

[0097] Exemplarily, the display area of ​​the target terminal window is as follows:

[0098] $ node -v

[0099] V18.12.0

[0100] $ms node 16

[0101] Info detects that the local version is not available and starts downloading the installation package

[0102] The installation package was downloaded successfully

[0103] Switched successfully, node version is v16.19.0, valid only in the current window

[0104] $ node -v

[0105] v16.19.0

[0106] In the above command lines, "$node -v" is used to query the current node version in the terminal window.

[0107] "V18.12.0" is used to indicate the complete historical version number. "$ms node 16" is the version switching instruction, which indicates that the current node version in the terminal window will be switched to version 16. Version 16 has a unique corresponding complete target version number. The "Info" command line includes a description of the execution of the version switching instruction, which is used for users to better understand the execution of the version switching instruction. The "Info" command line includes three lines of content: "Info detects that the local version does not exist and starts downloading the installation package", "The installation package was downloaded successfully", and "Switch successful, the node version is v16.19.0, which is only valid in the current window". "v16.19.0" is used to indicate the unique corresponding complete target version number of version 16.

[0108] To configure the temporary environment variables of the target terminal window according to the first installation address, refer to the corresponding description part of step S204.

[0109] In a specific implementation, the instruction processing method also includes: for any terminal window, when the terminal window is opened, running the environment variable configuration script; during the running of the environment variable configuration script, if the installation address information includes a third installation address of an application with a preset version number, the temporary environment variables of the terminal window are configured according to the third installation address.

[0110] Through the pre-written environment variable configuration script, temporary environment variables can be automatically configured when any terminal window is opened, thus achieving an effect similar to configuring global environment variables.

[0111] For example, you can automatically run a Bash script to switch to an initial Node version every time you open a terminal window, and then manually set other Node versions.

[0112] If the pre-stored installation address information includes a third installation address of an application program with a preset version number, the temporary environment variables of the terminal window are configured according to the third installation address, and the corresponding description part of step S204 may be referred to.

[0113] The preset version number can be customized.

[0114] In the first installation address, the second installation address, and the third installation address, "first", "second", and "third" are used to distinguish the installation addresses of the three version numbers of the application and have no actual meaning. The first installation address is different from the second installation address. The first installation address and the third installation address may be the same or different. The second installation address and the third installation address may be the same or different.

[0115] If the pre-stored installation address information does not include the third installation address of the application with a preset version number, download and install the corresponding version of the application according to the preset version number; obtain the third installation address of the application with the preset version number; configure the temporary environment variables of the terminal window according to the third installation address, and refer to the corresponding description part of the implementation method in which the aforementioned installation address information does not include the first installation address.

[0116] For example, if the basic environment version in the computer is v18, the version every time a terminal window is opened is v18. By using a pre-written Bash script to execute command processing methods, the application used in the terminal window can be temporarily switched from v18 to v16, which will become invalid after the terminal window is closed. However, some users find it troublesome to manually switch versions every time a terminal window is opened, so they can also execute the following command to achieve an effect similar to modifying global environment variables: msnode 16–g. Add “–g” to the version switching command, and the Bash script will be set to automatically execute the command to switch to v16 when the terminal window is opened, so that the user will use v16 version every time the terminal window is opened, which effectively allows users to perceive that v16 version is "globally effective."

[0117] In addition, you can also turn off "automatically execute the command to switch to v16 when opening the terminal window" by running the following command: ms node off. After turning off the "global effect", when you open the terminal window again, it will be restored to the basic environment v18, that is, it will not automatically switch to v16.

[0118] The underlying operating system can support automatic execution of Bash scripts when a terminal window is opened.

[0119] For example, the Max system works by storing Bash scripts in the / etc / profile.d / directory, and then automatically executing all Bash scripts in the directory each time you open a terminal window. In Windows, you need to modify the registry to automatically run the script when you open a terminal.

[0120] Step S206, when the target terminal window receives the preset instruction, the preset instruction is executed according to the temporary environment variable.

[0121] The temporary environment variable includes a mapping relationship between the first installation address of the target version number application and the operation instruction in the operation instruction set of the application, that is, a mapping relationship between the first installation address and the operation instruction of the application. In the mapping relationship, the operation instruction can point to the first installation address.

[0122] The preset instruction may be an instruction received by the target terminal window after the version is switched. The preset instruction may be an operation instruction in the operation instruction set of the application program.

[0123] Executing preset instructions according to temporary environment variables can be performed by determining the first installation address pointed to by the preset instructions based on the mapping relationship between the preset instructions and the first installation address and the operating instructions of the application, and then starting the application with the target version number at the first installation address, and executing the preset instructions through the application with the target version number.

[0124] In a specific implementation, a temporary environment variable includes a mapping relationship between a first installation address of an application of a target version number and an operation instruction in an operation instruction set of the application; executing a preset instruction according to the temporary environment variable includes: querying and obtaining a target installation address that has a mapping relationship with the preset instruction according to a mapping relationship between the preset instruction and the first installation address and the operation instruction of the application, and using the target installation address as an application search path; searching for an executable program according to the application search path, and running the executable program to execute the preset instruction.

[0125] The temporary environment variable may include a mapping relationship between a first installation address of an application of the target version number and an operation instruction in an operation instruction set of the application, that is, a mapping relationship between the first installation address and an operation instruction of the application.

[0126] The temporary environment variable may include one or more mapping relationships. When there are multiple mapping relationships, each mapping relationship has a corresponding application program.

[0127] For example, the temporary environment variables include: operation instructions of application 1 -> first installation address 1; operation instructions of application 2 -> first installation address 2; operation instructions of application 3 -> first installation address 3, and so on.

[0128] When the temporary environment variable includes multiple mapping relationships, query processing can be performed based on the mapping relationship between the preset instructions and the first installation address and the operation instructions of the application to obtain the target installation address that has a mapping relationship with the preset instructions, and use the target installation address as the application search path.

[0129] For example, the preset instruction is an operation instruction in the operation instruction set of application 3, and the temporary environment variable includes multiple mapping relationships: the operation instruction of application 1 -> first installation address 1; the operation instruction of application 2 -> first installation address 2; the operation instruction of application 3 -> first installation address 3, etc. By performing query processing based on the preset instruction and multiple mapping relationships, the target installation address that has a mapping relationship with the preset instruction can be queried: first installation address 3, and the first installation address 3 is used as the application search path.

[0130] Searching for the executable program according to the application search path and running the executable program to execute the preset instructions may be searching for an executable application in the application search path and then starting the application to execute the preset instructions.

[0131] In a specific implementation, after configuring the temporary environment variables of the target terminal window according to the first installation address, the instruction processing method also includes: receiving and executing an invalidation instruction of the temporary environment variable; when the target terminal window receives a preset instruction, executing the preset instruction according to the global environment variable; the global environment variable includes a mapping relationship between the second installation address of the application with a historical version number and the operation instruction in the operation instruction set of the application.

[0132] The temporary environment variable invalidation instruction is used to control the temporary environment variable to be invalid in the target terminal window.

[0133] After executing the invalidation instruction of the temporary environment variable, the temporary environment variable becomes invalid, and the global environment variable becomes effective. The global environment variable is used by default.

[0134] For executing preset instructions according to global environment variables, reference may be made to the corresponding description section of “executing preset instructions according to temporary environment variables” in the aforementioned step S206 .

[0135] In such Figure 2 In the embodiment shown, first, a version switching instruction for an application is obtained; the version switching instruction includes a target version number; if the pre-stored installation address information includes the first installation address of the application with the target version number, a temporary environment variable of the target terminal window is configured according to the first installation address; when the target terminal window receives the preset instruction, the preset instruction is executed according to the temporary environment variable. In this way, considering that in the target terminal window, the temporary environment variable will take precedence over the global environment variable to take effect, by configuring the temporary environment variable of the target terminal window according to the first installation address of the application with the target version number, the target terminal window can start the application with the target version number through the temporary environment variable to execute the preset instruction when receiving the preset instruction of the application, instead of executing the preset instruction by starting the application with the historical version number before the version switching. In addition, the switching version actually only needs to configure the temporary environment variable that takes effect in the target terminal window, and does not need to uninstall the old version file, which simplifies unnecessary repeated uninstallation and repeated installation operations, and improves the efficiency and flexibility of version switching.

[0136] Based on the same technical concept, the embodiment of the present application takes the application as an example to develop the application and also provides another instruction processing method. Figure 3 A processing flow chart of another instruction processing method provided in an embodiment of the present application.

[0137] like Figure 3 As shown, in step S302, the user executes a switch command for switching the development application version in the terminal window.

[0138] The switching command may refer to the “version switching instruction” in the aforementioned embodiment.

[0139] Step S304: the script intercepts the user's switching command.

[0140] Step S306: the script checks whether the development application of the target version number has been downloaded.

[0141] To detect whether the development application with the target version number has been downloaded, a query process can be performed based on the target version number in the pre-stored installation address information to obtain the query result of the target version number. If the query result indicates that the installation address information includes the first installation address, it means that the development application with the target version number has been downloaded. If the query result indicates that the installation address information does not include the first installation address, it means that the development application with the target version number has not been downloaded.

[0142] Step S308: Whether the target version has been downloaded.

[0143] Determine whether the development application of the target version number has been downloaded; if so, execute step S314; if not, execute step S310.

[0144] Step S310: the script calls the toolkit.

[0145] Step S312: the toolkit downloads the development application of the target version number and caches it.

[0146] Step S314: the script configures temporary environment variables of the terminal window.

[0147] Step S316, the terminal environment temporarily points to: the operating instructions for developing the application program->the application program installation address of the target version number.

[0148] Steps S306 to S316 may refer to the corresponding description of step S204 in the aforementioned method embodiment.

[0149] Step S318, the user executes the operation instruction and temporarily points to the application in the application installation address of the target version number.

[0150] For this step, reference may be made to the corresponding description of step S206 in the aforementioned method embodiment.

[0151] Step S320: After the terminal window is closed, the temporary pointing becomes invalid without affecting other terminal windows, which are independent of each other.

[0152] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts may refer to the corresponding description of the method embodiment provided above.

[0153] An embodiment of an instruction processing device provided in this specification is as follows:

[0154] In the above-mentioned embodiment, an instruction processing method is provided. Based on the same technical concept, the embodiment of the present application also provides an instruction processing device, which is described below in conjunction with the accompanying drawings.

[0155] Figure 4 This is a schematic diagram of an instruction processing device provided in an embodiment of the present application. This embodiment provides an instruction processing device 400, including:

[0156] The acquisition unit 402 is used to acquire a version switching instruction for the application program; the version switching instruction includes a target version number;

[0157] The configuration unit 404 is configured to configure the temporary environment variables of the target terminal window according to the first installation address if the pre-stored installation address information includes the first installation address of the application program of the target version number;

[0158] The execution unit 406 is configured to execute the preset instruction according to the temporary environment variable when the preset instruction is received in the target terminal window.

[0159] Optionally, the temporary environment variable includes a mapping relationship between a first installation address of the application of the target version number and an operation instruction in an operation instruction set of the application; when executing the preset instruction according to the temporary environment variable, the execution unit 406 performs the following steps:

[0160] According to the mapping relationship between the preset instruction and the first installation address and the operation instruction of the application, query and obtain a target installation address that has a mapping relationship with the preset instruction, and use the target installation address as the application search path;

[0161] An executable program is searched according to the application program search path, and the executable program is run to execute the preset instruction.

[0162] Optionally, when configuring the temporary environment variables of the target terminal window according to the first installation address, the configuration unit 404 performs the following steps:

[0163] Copying global environment variables; the global environment variables include a mapping relationship between a second installation address of an application with a historical version number and an operation instruction in an operation instruction set of the application and preset environment parameters;

[0164] Replacing the mapping relationship between the copied second installation address and the operation instruction of the application program by the first installation address to obtain the mapping relationship between the first installation address and the operation instruction of the application program;

[0165] The mapping relationship between the first installation address and the operation instruction of the application program and the copied preset environment parameters are added to the temporary environment variables of the target terminal window.

[0166] Optionally, the instruction processing device 400 further includes:

[0167] A running unit, used for running an environment variable configuration script for any terminal window when the terminal window is opened;

[0168] The configuration unit 404 is further configured to configure the temporary environment variables of the terminal window according to the third installation address if the installation address information includes a third installation address of the application with the preset version number during the execution of the environment variable configuration script.

[0169] Optionally, the instruction processing device 400 further includes:

[0170] An installation unit, configured to download and install a corresponding version of the application according to the target version number if the installation address information does not include the first installation address;

[0171] The obtaining unit 402 is further configured to obtain the first installation address;

[0172] The configuration unit 404 is further configured to configure temporary environment variables of the target terminal window according to the first installation address.

[0173] Optionally, the instruction processing device 400 further includes:

[0174] A receiving unit, configured to receive and execute an invalidation instruction of the temporary environment variable;

[0175] The execution unit is also used to execute the preset instruction according to the global environment variable when the preset instruction is received in the target terminal window; the global environment variable includes a mapping relationship between the second installation address of the application with a historical version number and the operation instruction in the operation instruction set of the application.

[0176] Optionally, the temporary environment variable becomes invalid after the target terminal window is closed.

[0177] In an embodiment of the present application, the instruction processing device includes: an acquisition unit, which is used to acquire a version switching instruction for an application; the version switching instruction includes a target version number; a configuration unit, which is used to configure a temporary environment variable of a target terminal window according to the first installation address if the pre-stored installation address information includes the first installation address of an application with a target version number; and an execution unit, which is used to execute the preset instruction according to the temporary environment variable when the target terminal window receives the preset instruction. In this way, considering that in the target terminal window, the temporary environment variable will take precedence over the global environment variable to take effect, by configuring the temporary environment variable of the target terminal window according to the first installation address of the application with the target version number, the target terminal window can start the application with the target version number through the temporary environment variable to execute the preset instruction when receiving the preset instruction of the application, instead of executing the preset instruction by starting the application with the historical version number before the version switching. In addition, the switching version actually only needs to configure the temporary environment variable that takes effect in the target terminal window, and does not need to uninstall the old version file, which simplifies unnecessary repeated uninstallation operations and repeated installation operations, and improves the efficiency and flexibility of version switching.

[0178] Corresponding to the instruction processing method described above, based on the same technical concept, an embodiment of the present application further provides an electronic device, which is used to execute the instruction processing method provided above. Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0179] like Figure 5 As shown, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 501 and memory 502, and the memory 502 may store one or more storage applications or data. Among them, the memory 502 can be a temporary storage or a permanent storage. The application stored in the memory 502 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 501 can be configured to communicate with the memory 502 to execute a series of computer executable instructions in the memory 502 on the electronic device. The electronic device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input / output interfaces 505, one or more keyboards 506, etc.

[0180] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs configured to be executed by one or more processors include the following computer executable instructions:

[0181] Obtaining a version switching instruction for an application; the version switching instruction includes a target version number;

[0182] If the pre-stored installation address information includes the first installation address of the application program of the target version number, configuring the temporary environment variables of the target terminal window according to the first installation address;

[0183] When the target terminal window receives a preset instruction, the preset instruction is executed according to the temporary environment variable.

[0184] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented:

[0185] Obtaining a version switching instruction for an application; the version switching instruction includes a target version number;

[0186] If the pre-stored installation address information includes the first installation address of the application program of the target version number, configuring the temporary environment variables of the target terminal window according to the first installation address;

[0187] When the target terminal window receives a preset instruction, the preset instruction is executed according to the temporary environment variable.

[0188] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the instruction processing method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding method mentioned above, and the repeated parts will not be repeated.

[0189] Another embodiment of the present disclosure further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following process is implemented:

[0190] Obtaining a version switching instruction for an application; the version switching instruction includes a target version number;

[0191] If the pre-stored installation address information includes the first installation address of the application program of the target version number, configuring the temporary environment variables of the target terminal window according to the first installation address;

[0192] When the target terminal window receives a preset instruction, the preset instruction is executed according to the temporary environment variable.

[0193] The computer program product in the embodiment of the present disclosure can implement each process of the above-mentioned instruction processing method embodiment and achieve the same effect and function, which will not be repeated here.

[0194] In the embodiment of the present application, first, obtain the version switching instruction for the application; the version switching instruction includes the target version number; if the pre-stored installation address information includes the first installation address of the application with the target version number, configure the temporary environment variable of the target terminal window according to the first installation address; when the target terminal window receives the preset instruction, execute the preset instruction according to the temporary environment variable. In this way, considering that in the target terminal window, the temporary environment variable will take precedence over the global environment variable to take effect, by configuring the temporary environment variable of the target terminal window according to the first installation address of the application with the target version number, the target terminal window can start the application with the target version number through the temporary environment variable to execute the preset instruction when receiving the preset instruction of the application, instead of executing the preset instruction by starting the application with the historical version number before the version switching. In addition, the switching version actually only needs to configure the temporary environment variable that takes effect in the target terminal window, and does not need to uninstall the old version file, which simplifies the unnecessary repeated uninstallation and repeated installation operations, and improves the efficiency and flexibility of version switching.

[0195] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0196] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may adopt the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0197] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable electronic device to produce a machine, so that the instructions executed by the processor of the computer or other programmable electronic device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0198] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable electronic device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0199] These computer program instructions may also be loaded onto a computer or other programmable electronic device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0200] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0201] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0202] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0203] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0204] Embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0205] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0206] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.

Claims

1. A command processing method, characterized in that: include: Obtaining a version switching instruction for an application; the version switching instruction includes a target version number; If the pre-stored installation address information includes the first installation address of the application program of the target version number, configuring the temporary environment variables of the target terminal window according to the first installation address; When the target terminal window receives a preset instruction, the preset instruction is executed according to the temporary environment variable.

2. The method according to claim 1, characterized in that The temporary environment variable includes a mapping relationship between a first installation address of the application program of the target version number and an operation instruction in an operation instruction set of the application program; The step of executing the preset instruction according to the temporary environment variable comprises: According to the mapping relationship between the preset instruction and the first installation address and the operation instruction of the application, query and obtain a target installation address that has a mapping relationship with the preset instruction, and use the target installation address as the application search path; An executable program is searched according to the application search path, and the executable program is run to execute the preset instruction.

3. The method according to claim 1, characterized in that The step of configuring the temporary environment variables of the target terminal window according to the first installation address includes: Copying global environment variables; the global environment variables include a mapping relationship between a second installation address of an application with a historical version number and an operation instruction in an operation instruction set of the application and preset environment parameters; Replacing the mapping relationship between the copied second installation address and the operation instruction of the application program with the first installation address to obtain the mapping relationship between the first installation address and the operation instruction of the application program; The mapping relationship between the first installation address and the operation instruction of the application program and the copied preset environment parameters are added to the temporary environment variables of the target terminal window.

4. The method according to claim 1, characterized in that: Also includes: For any terminal window, when the terminal window is opened, run the environment variable configuration script; During the running of the environment variable configuration script, if the installation address information includes the third installation address of the application with the preset version number, the temporary environment variables of the terminal window are configured according to the third installation address.

5. The method according to claim 1, characterized in that After obtaining the version switching instruction for the application program and before executing the preset instruction according to the temporary environment variable, the method further includes: If the installation address information does not include the first installation address, downloading and installing the corresponding version of the application according to the target version number; Obtaining the first installation address; The temporary environment variables of the target terminal window are configured according to the first installation address.

6. The method according to claim 1, characterized in that After configuring the temporary environment variables of the target terminal window according to the first installation address, the method further includes: Receiving and executing an invalidation instruction of the temporary environment variable; When the target terminal window receives the preset instruction, the preset instruction is executed according to the global environment variable; the global environment variable includes a mapping relationship between the second installation address of the application with a historical version number and the operation instruction in the operation instruction set of the application.

7. The method according to claim 1, characterized in that The temporary environment variable becomes invalid after the target terminal window is closed.

8. An instruction processing device, characterized in that: include: An acquisition unit, configured to acquire a version switching instruction for an application program; the version switching instruction includes a target version number; a configuration unit, configured to configure a temporary environment variable of a target terminal window according to the first installation address if the pre-stored installation address information includes a first installation address of the application program of the target version number; An execution unit is used to execute the preset instruction according to the temporary environment variable when the preset instruction is received in the target terminal window.

9. An electronic device, characterized in that: include: processor; And, a memory configured to store computer executable instructions, which, when executed, cause the processor to perform the instruction processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions, when executed by a processor, implement the instruction processing method according to any one of claims 1 to 7.

11. A computer program product, characterized in that The invention comprises a computer program, which implements the instruction processing method according to any one of claims 1 to 7 when being executed by a processor.