我需要从批处理文件中调用 C:\Program Files 目录中的 exe 文件。我们如何在批处理文件中提及目录名称“Program Files”。我收到类似 C:\Program 未找到的错误。
我相信 % 或 ~ 需要在两者之间添加但无法得到它。请协助。
谢谢
我需要从批处理文件中调用 C:\Program Files 目录中的 exe 文件。我们如何在批处理文件中提及目录名称“Program Files”。我收到类似 C:\Program 未找到的错误。
我相信 % 或 ~ 需要在两者之间添加但无法得到它。请协助。
谢谢
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"
在我的电脑上,我需要执行以下操作:
@echo off
start C:\"Program Files (x86)\VirtualDJ\virtualdj_pro.exe"
start C:\toolbetech\TBETECH\"Your Toolbar.exe"
exit
现在 bash 已经在 windows 10 中推出,如果你想从 bash 访问程序文件,你可以这样做
cd /mnt/c/Program\ Files
:
尽管我尝试使用start
打开 Chrome 并使用文件路径,但我遇到了与您类似的问题。我只用过start chrome.exe
,打开就好了。您可能想尝试对 exe 文件执行相同的操作。可能不需要使用文件路径。
以下是一些示例(使用您在另一个答案的评论中提供的文件名):
代替C:\Program^ Files\temp.exe
你可以试试temp.exe
。
而不是start C:\Program^ Files\temp.exe
你可以尝试start
temp.exe
我在我的批处理文件中使用 -c:\progra~2\
而不是C:\Program Files (x86)\
它可以工作。
有趣的是变量,这对我有用......
SET "VESTADIR=\\%TARGET%\C$\"Program Files (x86)"\Cassidian\VESTA"
用这个作为一些想法
"C:/Program Files (x86)/Nox/bin/nox_adb" install -r app.apk
在哪里
"path_to_executable" commands_argument
在创建 bat 文件时,您可以轻松避免空间。如果要在批处理文件中提及“程序文件”文件夹。
执行以下步骤:
1.输入c:
然后回车
2. cd program files
3. cd "choose your own folder name"
然后按您的意愿继续。
这样您就可以创建批处理文件,并且可以提及程序文件文件夹。