1

I'm trying to run a docker container which has mapserver/tileserver. While running command with cmd, the command finds the right map to run but when same command run with bat file it is goes to it's default map and runs that map. How can I make my own map as default map?

@echo off

cmd /c docker run --rm -it -v %cd%:/data -p 8083:80 --name ta_mapserver klokantech/tileserver-gl

PAUSE

Here is my command in bat file.

Thanks for helping.

Jiraiya
  • 101
  • 1
  • 9
  • 1
    When you run it without `@echo off` - does `%cd%` show the correct folder? – Stephan Sep 10 '20 at 10:32
  • @Stephan Thank you for your time. No. Is shows desktop how can i change it to the folder that i want? – Jiraiya Sep 10 '20 at 11:33
  • 1
    I thought so. Which folder do you want? The folder where your batchfile resides? (that's `%~dp0`). Else replace `%cd%` with the folder you want. – Stephan Sep 10 '20 at 11:39
  • 2
    Why are you running your command as an argument to `cmd /c`? The batch file, by its very nature, is already running in a single `cmd.exe` instance. – Compo Sep 10 '20 at 12:26
  • It looks like you are using `%cd%` as the drive letter only. If that is the case, replace it with `%~d0`. – lit Sep 10 '20 at 14:35
  • …or if that was the case @lit, as the current directory may not be the file holding the running script, `%CD:~,2%`. Although if that was the case, I'd envisage that simply `\data` or `/data`, would suffice, _because `\ ` should always reference the root of the current drive_. – Compo Sep 10 '20 at 18:05

0 Answers0