tags:

views:

898

answers:

1

I am trying to set up an autorun.inf file and batch file in order to check to see if a program is installed. If not, I want to run the install file upon plugging in the usb drive. Here is my code:

setlocal
set VMP=C:\Program Files\VMware\VMware Player\
cd C:\Program Files\VMware\VMware Player\
if exist %VMP% (
start vmx
) else (
start VMware-player-2.5.2-156735.exe 
)

vmx is a shortcut in the root of the usb stick that points to the .vmx file I want to run. It is opening both files at the same time regardless of whether %VMP% exist. Can anyone help me out?

+1  A: 

put your paths in quotes.

setlocal
set VMP="C:\Program Files\VMware\VMware Player\"
cd "C:\Program Files\VMware\VMware Player\"
if exist %VMP% (
start vmx
) else (
start VMware-player-2.5.2-156735.exe 
)
Daniel A. White
Shouldn't be necessary for neither the set nor the cd commands. Both deal fine with spaces in paths.
Joey