How do I write a batch file to run multiple commands in cmd within the same folder?

  admin, batch-file, cmd, windows

I need some help. I’m trying to create a batch file to run a CMD code.

Basically I want the .bat script to run cmd within the same folder. I’ve tried some scripts but they’re not working as I want them to.

What I usually do is :

Open CMD as Admin

  1. cd C:TargetFolder
  2. load.exe meto.sys gk.sys

I tried this code

  @echo off
:: BatchGotAdmin
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%system32cacls.exe" "%SYSTEMROOT%system32configsystem"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%getadmin.vbs"
    del "%temp%getadmin.vbs"
    exit /B
    pushd "%CD%"
    CD /D "%~dp0"
load.exe meto.sys gk.sys
@if NOT ["%errorlevel%"]==["0"] pause

But can’t get it to work. Some help would be appreciated

Source: Windows Questions