It is possible to use a few of the shell commands in windows. Though there is this program called windows power shell, most of us are not familiar with batch scripting. So we could use Cygwin , a project that has windows executable files performing the operations of the shell.
There is not much to explain about this file. Just go through its source code and you will pretty much understand those 5 lines of code. It just sets the working directory to
<Cygwin_installation_directory>. In my case it is
This directory contains the shell command executable files like
cat.exe, chmod.exe, chown.exe, cp.exe, diff.exe, find.exe, su.exe, touch.exe, less.exe, ls.exe, which.exe, who.exe, etc.
Now we have to add this directory to the PATH environment variable. In windows, there are two Path variables – User Path and the System Path. We will add this to the system PATH variable. When you do a echo %PATH% in command prompt, you will see a concatenated list of System Path and User Path.
Open System Properties
- Right Click My Computer –> Properties –> Advanced System Settings.
- Control Panel –> System –> Advanced System Settings.
Select Advanced tab.
Click Environment Variables button.
Under System Variables fieldset, scroll down to " Path " under variables column, and select this entry.
Click Edit, and in this Variable Value textbox, append the
<Cygwin_installation_dir>with a semi-colon as the separator.
- Variable Value : foo;bar;C:\Cygwin\bin
Select OK consecutively for all the dialog boxes that you opened – confirming changes.
Now you can use all the exe files in the
Cygwin_installation_dir as a command in command prompt.
C:/>ls -lta | grep cygwin drwxr-xr-x+ 1 Boopathi Rajaa root 4096 Feb 24 00:14 cygwin