0

I create portable QGIS. It is done by copy QGIS2 folder in other computer. I have startup file so that QGIS will do the command. I can run QGIS in batch file. The code :

echo D | xcopy /s/e/y "%~dp0DATA\.qgis2" C:\Users\%username%\.qgis2
start /d "Running QGIS2" /D "%~dp0DATA\QGIS2\bin" qgis.bat

Then I want to open 1.qgs project. Then I add the code :

start /d "Running QGIS2" /D "%~dp0DATA\QGIS2\bin" qgis.bat "%~dp0DATA\PROJECT" 1.qgs

But, there is a message. Unable to open D:/./././1.qgs. So, what's wrong in my code?

Magoo
  • 77,302
  • 8
  • 62
  • 84
mega
  • 5
  • 3
  • Do you have read the help output on running `start /?` as I suggested on your [first question](http://stackoverflow.com/questions/42219419/)? It does not look so. `/d` as first option results in interpreting `"Running QGIS2"` as start in directory path and not as title string. And I suppose `"%~dp0DATA\PROJECT" 1.qgs` should be `"%~dp0DATA\PROJECT\1.qgs"`, i.e. one parameter (file name 1.qgs with full path) instead of two parameters (folder path and file name separately). – Mofi Feb 20 '17 at 06:26

1 Answers1

0

Since you are starting the process, there is no guarantee that the directory that qgis sees as "current" is the same as the batch directory.

Fully-qualify the parameter 1.qgs - prefix it with the the appropriate directoryname.

Alternatively, modify qgis.bat to display %cd% and pause. That will show you where qgis believes its current directory is. That information should allow you to make appropriate adjustments.

Magoo
  • 77,302
  • 8
  • 62
  • 84