The Path command is used to execute EXE files which is located other than the current directory.
When you execute a command , Operating System will search the command in the current directory , if the command is not available in the current directory , then OS will search the folders specified using PATH command.
Path Displays or sets a search path for executable files. This is an Internal Command which is available in the following operating systems.
MS-DOS
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista
Windows 7
Syntax : PATH [[drive:]path[;...][;%PATH%]
PATH ;
Uses :
Path - to Display the current paths
Path; - to clear all search path which is currently available and the os will search only in the current directory.
path=d:\Sun\SDK\jdk\bin;
Now the path is set to d:\Sun\SDK\jdk\bin; which you can execute javac , java executable files from the current directory.
path=%path%;d:\Sun\SDK\jdk\bin; Search path includes already available search path + d:\Sun\SDK\jdk\bin;
Example : How to set path for java package from the current folder ?
--------
d:\Javacode> - folder where your java files are located.
d:\Sun\SDK\jdk\bin; - folder where javac, java (java compiler, interpreter) are located.
Now you set the path from the current folder as follows
d:\Javacode> path=%path%;d:\Sun\SDK\jdk\bin;
- Now you can compile , run the java files from the javacode folder.
0 comments:
Post a Comment