dustybusty12
dustybusty12

Reputation: 107

Create a batch file to run an .exe with one argument

I want to create a batch file that a user can run ... in the batch file I want to run an exe with one argument.

Here is what I have today:

@echo off
c:\
cd "C:\Program Files (x86)\App Location\App34\"
start HelperSetup.exe -arg

When I run that it opens up the cmd window and says the path cannot be found but i know for 100% it is the correct path.

I have tried to also pass in the string in a one line but no joy

"C:\Program Files(x86)\App Location\App34\HelperSetup.exe -arg"

Upvotes: 1

Views: 23739

Answers (1)

Marcus
Marcus

Reputation: 1162

I have tried to also pass in the string in a one line but no joy

When you want to also pass in the string in a one line you need to set the closing quote at the end of the path like this:

"C:\Program Files(x86)\App Location\App34\HelperSetup.exe" -arg

A much simpler approach for your batch script is to use the following command sequence

start /d "C:\Program Files (x86)\App Location\App34\" HelperSetup.exe -arg

This way, you don't need to change the drive and the cd command at all.

Upvotes: 1

Related Questions