How to bat file in cmd command

are

Well-known member
Joined
Aug 20, 2018
Posts
75
For a program's setting change, I have to go to the relevant directory and run a code 3 times.

For this I have to go under cd C:\ProgramFiles\eyup\bin\admincmd and run the command in quotes "adprex.exe -rareadconfig" 2 times.

I want to write this as a bat file, how can I do it?

cd C:\ProgramFiles\eyup\bin\admincmd>adprex.exe -rareadconfig

Or should it be

cd C:\ProgramFiles\eyup\bin\admincmd
adprex.exe -rareadconfig
 
If, by "C:\ProgramFiles", you're really referring to "C:\Program Files", that can be referenced with the %ProgramFiles% environment variable. Note that we have to encase "%_bin%" in quotes because there's a whitespace in "Program Files".
Code:
@echo off

set _bin=%ProgramFiles%\eyup\bin\admincmd\adprex.exe
"%_bin%" -rareadconfig
"%_bin%" -rareadconfig

However, if you truly do have something installed in "C:\ProgramFiles", you'll need a slight adjustment. In this case, %_bin% doesn't need to be encased in quotes since there are no whitespaces in the path, but, at the same time, encasing it in quotes will still work and wouldn't hurt anything.
Code:
@echo off

set _bin=C:\ProgramFiles\eyup\bin\admincmd\adprex.exe
%_bin% -rareadconfig
%_bin% -rareadconfig
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top