Reputation:

Usb Autorun and Batch File

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?

Upvotes: 0

Views: 3882

Answers (1)

Daniel A. White
Daniel A. White

Reputation: 190907

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 
)

Upvotes: 1

Related Questions