How to mention C:\Program Files in batchfile

后端 未结 7 2128
迷失自我
迷失自我 2021-02-01 17:03

I need to invoke an exe file in C:\\Program Files directory from a batch file.How can we mention the directory name \"Program Files\" in batch file.I am getting error like C:\\P

7条回答
  •  天涯浪人
    2021-02-01 17:24

    Surround the script call with "", generally it's good practices to do so with filepath.

    "C:\Program Files"
    

    Although for this particular name you probably should use environment variable like this :

    "%ProgramFiles%\batch.cmd"
    

    or for 32 bits program on 64 bit windows :

    "%ProgramFiles(x86)%\batch.cmd"
    

提交回复
热议问题