'How to mention C:\Program Files in batchfile
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:\Program not found.
I believe that % or ~ needs to be added in between but couldn't get it.Kindly assist.
Solution 1:[1]
On my pc I need to do the following:
@echo off
start C:\"Program Files (x86)\VirtualDJ\virtualdj_pro.exe"
start C:\toolbetech\TBETECH\"Your Toolbar.exe"
exit
Solution 2:[2]
Now that bash is out for windows 10, if you want to access program files from bash, you can do it like so:
cd /mnt/c/Program\ Files.
Solution 3:[3]
I had a similar issue as you, although I was trying to use start to open Chrome and using the file path. I used only start chrome.exe and it opened just fine. You may want to try to do the same with exe file. Using the file path may be unnecessary.
Here are some examples (using the file name you gave in a comment on another answer):
Instead of
C:\Program^ Files\temp.exeyou can trytemp.exe.Instead of
start C:\Program^ Files\temp.exeyou can trystart temp.exe
Solution 4:[4]
I use in my batch files - c:\progra~2\ instead of C:\Program Files (x86)\ and it works.
Solution 5:[5]
use this as somethink
"C:/Program Files (x86)/Nox/bin/nox_adb" install -r app.apk
where
"path_to_executable" commands_argument
Solution 6:[6]
Interestingly with variables ,this worked for me ...
SET "VESTADIR=\\%TARGET%\C$\"Program Files (x86)"\Cassidian\VESTA"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chris G |
| Solution 2 | antoni |
| Solution 3 | A Child of God |
| Solution 4 | Pmpr.ir |
| Solution 5 | Роман Зыков |
| Solution 6 | Mike Q |
