Adding a directory to the PATH environment variable in Windows

前端 未结 18 1345
我在风中等你
我在风中等你 2020-11-21 05:13

I am trying to add C:\\xampp\\php to my system PATH environment variable in Windows.

I have already added it using the Environment Varia

18条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-21 05:52

    In a command prompt you tell Cmd to use Windows Explorer's command line by prefacing it with start.

    So start Yourbatchname.

    Note you have to register as if its name is batchfile.exe.

    Programs and documents can be added to the registry so typing their name without their path in the Start - Run dialog box or shortcut enables Windows to find them.

    This is a generic reg file. Copy the lines below to a new Text Document and save it as anyname.reg. Edit it with your programs or documents.

    In paths, use \\ to separate folder names in key paths as regedit uses a single \ to separate its key names. All reg files start with REGEDIT4. A semicolon turns a line into a comment. The @ symbol means to assign the value to the key rather than a named value.

    The file doesn't have to exist. This can be used to set Word.exe to open Winword.exe.

    Typing start batchfile will start iexplore.exe.

    REGEDIT4
    ;The bolded name below is the name of the document or program, .
    
    [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\Batchfile.exe]
    
    ; The @ means the path to the file is assigned to the default value for the key.
    ; The whole path in enclosed in a quotation mark ".
    
    @="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\""
    
    ; Optional Parameters. The semicolon means don't process the line. Remove it if you want to put it in the registry
    
    ; Informs the shell that the program accepts URLs.
    
    ;"useURL"="1"
    
    ; Sets the path that a program will use as its' default directory. This is commented out.
    
    ;"Path"="C:\\Program Files\\Microsoft Office\\Office\\"
    

    You've already been told about path in another answer. Also see doskey /? for cmd macros (they only work when typing).

    You can run startup commands for CMD. From Windows Resource Kit Technical Reference

    AutoRun

    HKCU\Software\Microsoft\Command Processor
    
    Data type Range Default value
    REG_SZ  list of commands  There is no default value for this entry.
    

    Description

    Contains commands which are executed each time you start Cmd.exe.

提交回复
热议问题