Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mention C:\Program Files in batchfile

Tags:

batch-file

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.

like image 849
explorer Avatar asked Oct 29 '13 08:10

explorer


People also ask

How do I include a program in command prompt?

While in the command prompt type "cd\", then enter. From there type "cd\program" then hit the tab button until you see "c:\program files (x86)", then hit enter.

How do I add a file to a batch file?

Content writing to files is also done with the help of the double redirection filter >>. This filter can be used to append any output to a file. Following is a simple example of how to create a file using the redirection command to append data to files.


3 Answers

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"
like image 50
Rémi Benoit Avatar answered Oct 19 '22 04:10

Rémi Benoit


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
like image 8
user5861369 Avatar answered Oct 19 '22 04:10

user5861369


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.

like image 2
antoni Avatar answered Oct 19 '22 02:10

antoni