Tip: cd to the folder that contains the script launched

Unix/Linux:

#!/bin/sh
LAUNCH_FOLDER=`dirname "$0"`;
cd $LAUNCH_FOLDER;

Windows:

cd %~dp0

You can get a lot more information using different modifiers:

%~0         - expands %I removing any surrounding quotes (")
%~f0        - expands %I to a fully qualified path name
%~d0        - expands %I to a drive letter only
%~p0        - expands %I to a path only
%~n0        - expands %I to a file name only
%~x0        - expands %I to a file extension only
%~s0        - expanded path contains short names only
%~a0        - expands %I to file attributes of file
%~t0        - expands %I to date/time of file
%~z0        - expands %I to size of file

The modifiers can be combined to get compound results:
%~dp0       - expands %I to a drive letter and path only
%~nx0       - expands %I to a file name and extension only
%~fs0       - expands %I to a full path name with short names only

Ref: http://stackoverflow.com/questions/659647/how-to-get-folder-path-from-file-path-with-cmd