Amir133
Amir133

Reputation: 2712

Cannot run a batch code as admin privilege

I am using a batch code in removal Disk to install some software (from removal Disk).

My Problem is I need to run this batch code as administrator , but when I ran it as administrator it ran from C:\Windows\system32 but my installer path is different.

This is a sample script :

Setup1.exe /S
Setup2.exe /S

Now how can I change the directory to installer path after run as admin

Upvotes: 0

Views: 62

Answers (1)

Compo
Compo

Reputation: 38614

As per my comment:

You can either add the following to the top of your batch script:

@CD /D "%~dp0"

…or prefix your setup file like this:

"%~dp0setup.exe" /S

Upvotes: 1

Related Questions