33

我需要从批处理文件中调用 C:\Program Files 目录中的 exe 文件。我们如何在批处理文件中提及目录名称“Program Files”。我收到类似 C:\Program 未找到的错误。

我相信 % 或 ~ 需要在两者之间添加但无法得到它。请协助。

谢谢

4

8 回答 8

57

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"
于 2013-10-29T08:02:49.860 回答
8

在我的电脑上,我需要执行以下操作:

@echo off
start C:\"Program Files (x86)\VirtualDJ\virtualdj_pro.exe" 
start C:\toolbetech\TBETECH\"Your Toolbar.exe"
exit
于 2016-01-30T15:15:32.533 回答
2

现在 bash 已经在 windows 10 中推出,如果你想从 bash 访问程序文件,你可以这样做cd /mnt/c/Program\ Files

于 2016-12-14T02:37:56.530 回答
1

尽管我尝试使用start打开 Chrome 并使用文件路径,但我遇到了与您类似的问题。我只用过start chrome.exe,打开就好了。您可能想尝试对 exe 文件执行相同的操作。可能不需要使用文件路径。

以下是一些示例(使用您在另一个答案的评论中提供的文件名):

  • 代替C:\Program^ Files\temp.exe你可以试试temp.exe

  • 而不是start C:\Program^ Files\temp.exe你可以尝试start temp.exe

于 2017-02-10T21:55:39.187 回答
1

我在我的批处理文件中使用 -c:\progra~2\而不是C:\Program Files (x86)\它可以工作。

于 2020-03-14T11:09:47.197 回答
0

有趣的是变量,这对我有用......

SET "VESTADIR=\\%TARGET%\C$\"Program Files (x86)"\Cassidian\VESTA"
于 2021-10-23T02:52:05.187 回答
0

用这个作为一些想法

"C:/Program Files (x86)/Nox/bin/nox_adb" install -r app.apk

在哪里

"path_to_executable" commands_argument
于 2019-08-17T14:42:13.067 回答
-4

在创建 bat 文件时,您可以轻松避免空间。如果要在批处理文件中提及“程序文件”文件夹。

执行以下步骤:

1.输入c:然后回车

2. cd program files

3. cd "choose your own folder name"

然后按您的意愿继续。

这样您就可以创建批处理文件,并且可以提及程序文件文件夹。

于 2014-04-25T05:37:21.883 回答