A quick way to perform command-line operations in Java or PHP

Source: Internet
Author: User

Some CLI services need to run on the same server as the third-party application system. In accordance with common methods of operation, this time will usually build the business needs of the environment, such as the installation of certain software, configuration environment variables. Sometimes the version of Java or PHP may be different, sometimes the local server does not have the relevant environment. Doing so will pollute the environment of the third-party application system (which may vary in degree).

It is possible to avoid contamination by operating in the following manner.

Extract the necessary DLL files to a specific folder, unzip Java or PHP and place them under the relevant folder.

Define a batch document, add the above two folders to the environment variable (only valid under current command-line process at this time)

For example:

Title A System interface

Set path=%path%;D: \amsoainterface\extforwin;

@ D:\AmsOaInterface\php\php.exe D:\AmsOaInterface\Entrance\index.php home/index/index.html

When you test Java or PHP at the command line, you need to set environment variables or frequently enter a path, which is more cumbersome and defines the following batch processing:

Title "Java CMD"

Set Path=d:\java\jdk1.8.0_60\bin; C:\Windows\System32

Cmd

::p ause #Here is the comment

When the batch finishes executing, the current process is ended by default. If you pause execution with pause, you cannot enter additional command execution.

By adding cmd at this point, you can bring up the CLI in the current process and continue executing other commands. When setting an environment variable, you need to add the folder where the cmd is located (or add the current system all environment variable%path%), or the window will close automatically when the command is not found.

A quick way to perform command-line operations in Java or PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.