Tuesday, February 17, 2015

WinBin V1.0

WinBin V1.0

No matter what OS you use, if you use any console or command line interface then you know that if your script or executable isn't in a path the computer can read or if the cli is not in the direct path of the said file then it can not be run/found.

In most Linux systems there is a user bin system usually located in $HOME/bin where you can drop any of your user installed programs or scripts and they can be run form the terminal just like any system command.

In Windows it's not so simple (although, not so hard either) as any path read by Windows must be declared in the PATH(%PATH%) variable.

The problem with Windows is that the preset paths are all in system folders and there can be some permission and security issues with some utilities you may use. So it is best to just stay away from system folders when possible. The way to do this is by adding a custom directory designated for the user and adding the directories location to the PATH variable.

For example I create a directory: C:\Bin and then enter this location into the variable from cmd this: setx /m PATH "%PATH%;C:\Bin". And now I can drop whatever scripts or executable into the C:\Bin folder and run them from anywhere on the computer from cmd or any other cli.


I do this on every Windows rig I have and so I have created a quick bat to exe script to automate this process with slight error checking. WinBin V1.0 when started will check for a Bin folder and if exist warns the user that the old folder should be moved or deleted to complete the process. If no folder is found it continues to add the new directory and adds the location to the PATH variable. It then checks to makes sure the two functions were executed successfully and if so you can then use the system, if not you either have two many characters in your PATH variable (usually mostly from installed software) or the folder wasn't created successfully.


After the system is installed successfully then just drop anything at all that can be run from a cli into the C:\Bin folder and run from the cli!!! Very simple and quick and portable!


Icon I created

 photo WinBin_zpsae822e61.png

No comments: