[osgeo4w-dev] Re: cd before run

andrea antonello andrea.antonello at gmail.com
Thu Mar 31 12:32:41 EDT 2011


Hi Matt,

> "cd /d xxx" is change directory and drive
> "cd xxx" is change dir on current drive.

ugh, that one I could have guessed to be at least existing. Thanks.

> However I would use pushd instead of cd, it has the benefit of working with
> UNC paths as well (by automatically mapping to a free drive letter).
>
> more info http://ss64.com/nt/pushd.html

And that one is even better, it also works from powershell, whereas
the cd /d option does not.

> If for some reason you need the drive/path of the batch file starting udig
> use %0, as follows:
>
>  %~nx0 - the actual name of the batch file, regardless of calling method
> (some-batch.bat)
>  %~dp0 - drive and path to the script (d:\scripts)
>  %~dpnx0 - is the fully qualified path name of the script
> (d:\scripts\some-batch.bat)
>
> from
> http://stackoverflow.com/questions/357315/get-list-of-passed-arguments-in-windows-batch-script-bat/382312#382312
>
> This is how the %OSGEO4W_ROOT% variable is set  (see osgeo4w.bat).

Thanks, all very helpfull,
Andrea



>
>
> matt wilkie
> --------------------------------------------
> Geomatics Analyst
> Information Management and Technology
> Yukon Department of Environment
> 10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
> 867-667-8133 Tel * 867-393-7003 Fax
> http://environmentyukon.gov.yk.ca/geomatics/
> --------------------------------------------
>
> On 31/03/2011 8:09 AM, andrea antonello wrote:
>>
>> Ok, I already have a problem with this.
>>
>> It doesn't work if the folder from which the application is launched
>> is different from C: (a user reported it).
>> In that case the changedir command won't end into the right folder.
>> So the idea would be to change it to:
>>
>> c:
>> cd "%OSGEO4W_ROOT%\apps\udig-dev"
>> @start /B "BeeGIS" "udig_internal.exe" --launcher.ini beegis.ini %*
>>
>> But in that case if someone installs on a disk different from c:, that
>> would not work also.
>>
>> Is there a variable that tells me the disk in which the installation
>> occurred?
>> So that I could do:
>>
>> %DISK%:
>> cd "%OSGEO4W_ROOT%\apps\udig-dev"
>> @start /B "BeeGIS" "udig_internal.exe" --launcher.ini beegis.ini %*
>>
>>
>> Any other idea?
>>
>> Thanks,
>> Andrea
>>
>>
>> On Thu, Mar 31, 2011 at 11:44 AM, andrea antonello
>> <andrea.antonello at gmail.com>  wrote:
>>>
>>> Hi, for technical reasons I need to cd into the apps folder before
>>> exeecuting the application.
>>> I changed the startup script to do so as:
>>> cd "%OSGEO4W_ROOT%\apps\udig-dev"
>>> @start /B "BeeGIS" "udig_internal.exe" --launcher.ini beegis.ini %*
>>>
>>> it works. Just wondering if there is a more "windows" way to execute
>>> an application from within a path.
>>>
>>> Thanks,
>>> Andrea
>>>
>> _______________________________________________
>> osgeo4w-dev mailing list
>> osgeo4w-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
>> .
>>
> _______________________________________________
> osgeo4w-dev mailing list
> osgeo4w-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
>


More information about the osgeo4w-dev mailing list