Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 批量错误';C:\Program';不被承认_Batch File - Fatal编程技术网

Batch file 批量错误';C:\Program';不被承认

Batch file 批量错误';C:\Program';不被承认,batch-file,Batch File,我试试这批 start cmd.exe /k "C:\Program Files (x86)\QGIS 2.18\OSGeo4W.bat" ogr2ogr.exe -f "PostgreSQL" PG:"host=10.210.1.32 user=eric_plassot dbname=activite schemas=activite password=mdp" -t_srs EPSG:2154 -append -nlt PROMOTE_TO_MULTI "C:\Users\eplassot

我试试这批

start cmd.exe /k "C:\Program Files (x86)\QGIS 2.18\OSGeo4W.bat" ogr2ogr.exe  -f "PostgreSQL" PG:"host=10.210.1.32 user=eric_plassot dbname=activite schemas=activite password=mdp" -t_srs EPSG:2154 -append -nlt PROMOTE_TO_MULTI "C:\Users\eplassot\toto.kml"
然后得到这个错误

C: \ Program' is not recognized...

我能做什么?

因为您使用了多个引号,所以从语法上讲,嵌套引号的起始位置不清楚。试试这个:

start cmd.exe /k ""C:\Program Files (x86)\QGIS 2.18\OSGeo4W.bat" ogr2ogr.exe  -f "PostgreSQL" PG:"host=10.210.1.32 user=eric_plassot dbname=activite schemas=activite password=mdp" -t_srs EPSG:2154 -append -nlt PROMOTE_TO_MULTI "C:\Users\eplassot\toto.kml""
  • start
    可能会将第一个引用的参数解释为窗口标题,因此明确提供一个(甚至可能是空的,如
    “”
    )以避免出现问题
  • cmd/K
    使用前导和尾随引号,因此剩余的命令行无效。为了避免这种情况,请将整个命令行括起来以调用
    ”。要避免转义命令行,请转义最外面的引号:

    start”“cmd.exe/K^”“C:\ProgramFiles(x86)\QGIS 2.18\OSGeo4W.bat”ogr2ogr.exe-f”PostgreSQL”PG:“host=10.210.1.32 user=eric\u plassot dbname=activate schemas=activate password=mdp”—t\u srs EPSG:2154-append-nlt PROMOTE\u-TO\u MULTI“C:\Users\eplassot\toto.kml”^”
    

  • 第一批被称为

    @echo off
    
    rem根OSGEO4W home dir指向此脚本所在的同一目录 设置OSGEO4W_根=%~dp0 rem将双反斜杠转换为单反斜杠 设置OSGEO4W\u根=%OSGEO4W\u根:\=\% 回声,echo OSGEO4W home是%OSGEO4W_ROOT%&echo

    设置路径=%OSGEO4W\u根%\bin;%路径%

    rem添加特定于应用程序的环境设置 对于(“%OSGEO4W\u ROOT%\etc\ini*.bat”)中的%%f,请调用“%%f”

    rem列出可用的o4w程序 rem,但仅当在没有参数的情况下调用osgeo4w时 @呼应
    @如果[%1]=[](echo运行o-help以获取可用命令列表&cmd.exe/k)else(cmd/c“%*”

    Helloth的可能副本,则会导致cmd.exe循环,因此如果我粘贴命令“c:\Program Files(x86)\QGIS 2.18\OSGeo4W.bat”ogr2ogr.exe-f“PostgreSQL”PG:“host=10.210.1.32 user=eric\u plassot dbname=activity schemas==Mdp”-t\u srs EPSG:2154-append-nlt PROMOTE\u TO\u MULTI”C:\Users\eplassot\toto.kml“在命令窗口中,您的代码是否在每个反斜杠前后包含这些空格?”?基本上,你需要用空格引用每一个参数,引用到可执行文件的路径,最后引用
    cmd/k
    之后的所有内容感谢一大堆建议:不要将脚本命名为与任何命令相同的名称。hello,与双引号相同的结果是:命令会无限重复。如果我做了cd C:\Users\eplassot,然后粘贴这个代码“C:\ProgramFiles(x86)\QGIS 2.18\OSGeo4W.bat”ogr2ogr.exe-f“PostgreSQL”PG:“host=10.210.1.32 user=eric\u plassot dbname=activite schemas=activite password=mdp”-t_srs EPSG:2154-append-nlt PROMOTE\u-TO_MULTI”C:\Users\eplassot\toto.kml“它可以工作,我不能批量复制它很抱歉,我听不懂;没有循环,我看不到批处理文件
    OSGeo4W.bat
    中有什么内容,所以我无法判断。。。