With some help, I wrote a script to convert a set of GPS data using GPSBabel from its .nav file (which is really just a comma delimited file) to a GPX file that can be read by various cycling websites. After converting, it names the new GPX file after the existing .nav file.
The problem is, when it converts, it keeps the .nav on the end of the gpx file. For example, if the original file was named "tuesdayhillride.nav" the file that would be created would be "tuesdayhillride.nav.gpx"
What in thie follow simple batch script can I change to hav ethe file just named tuesdayhillride.gpx?
The script is below. I assume nothing else matters except the end...
for %%p in (*.nav) do "C:\program files (x86)\gpsbabel\gpsbabel" -i xcsv,style=mainnav.style -f "%%p" -o gpx -F "%%p.gpx"
how to change file extension
Moderator: DosItHelp
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: how to name files wthout extension (explained inside)
At the very end, change "%%p.gpx" to "%%~np.gpx"
~n will shorten the path to just the file name.
You may also have to change the main part of the for loop to
for /f "delims=" %%p in ('dir /b *.nav') do
~n will shorten the path to just the file name.
You may also have to change the main part of the for loop to
for /f "delims=" %%p in ('dir /b *.nav') do