Jun 10, 2011

The easiest way to run an executable that take as entry files that are on another directory



This tutorial is for shell - unfamiliar people; it unable them to run; on the command prompt a program that take as an input a file that is on different directory. (If you know how to use cd .. ) this tutorial isn't for you. But it could accelerate the process if you don't want to type a long command each type if you have multiple sub directory between the executable and data file.




Let’s say we have this architecture for a program called hello and it takes as input the data1.dat that is in a sub directory



C:\>
|__hello (dir)
|__hello.exe
|__data(dir)
|__data1.dat

First you create in you data folder a shortcut to the executable:
1- Go to data Folder and right click
2- Choose to new -> Shortcut

3- Browse to the location of your executable (hello world)


4- Finish the process
5- Right click on the newly create link and go to properties
6- Empty the field Run In. (it is c:\hello\) delete it.

Create a cmd shortcut
One last thing create also cmd shortcut in the data directory if you don't want to type cd each time

1- Go to data Folder and right click
2- Choose to new -> Shortcut


3- Type cmd in the path and then click on next then finish




4- Also you should Right click the link and empy the field Run




To run the program :

Click on the (cmd) link that you created and the command prompt should pop up , Type the name of the link to you executable then the name of your data input file .
In this case it should be
C:\hello\data> hello.exe.lnk data1.dat
NB : I know that in this case we can also time ..\hello.exe data1.dat but this example was written to help the people that are unfamiliar with shell and the data is in sub -sub-sub directory

No comments: