Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

How to run a bat file as admin?

- - - - -

  • Please log in to reply
4 replies to this topic

#1
Th3_uN1Qu3

Th3_uN1Qu3

    Digital sinner

  • Member
  • PipPipPip
  • 386 posts
  • Joined 17-March 08
Just when i thought i fixed all bugs in the game i was patching, i realized it would throw voice errors under Vista or under updated XP. Turns out the game is hooked to a certain version of the ADPCM codec, and the one from 9x/Me/2k works, and the one from un-updated XP works. But when i update XP or try it under vista, boom. :no:

The problem is that those two ADPCM codec files are located in system32, and Vista asks for admin privileges to replace them. I need to do this via the command line or via an AutoIt script, with none or minimal interaction from the user. The only prompting i can accept would be asking for an administrator password to replace the files.

Help please? Or i'm going back to XP, thank you. But it would be unfair to make the game only work on XP.
What's the point of security features if we have to disable them for things to work right?

p35-ds3 / e6550 @ 3.5ghz 500fsb scythe mugen / 8gb pqi ddr2 800 @ 1000 / sapphire hd3870 / 320gb wd / x64 / nokia 920c 19"
toshi portege 4010 / p3 tualatin @ 933mhz / 512mb pc133 sdram / 16mb cyberblade / wifi / irda / sd / 30gb ibm / me / 12.1" tft
6bxds / 2x p3 @ 700mhz / 1gb cl2 sdram / sapphire 9800 pro 256mb / awe64 isa / sil3112a pci + 320gb wd / xp / thomson 24" tv


How to remove advertisement from MSFN

#2
Smiley357

Smiley357

    Junior

  • Member
  • Pip
  • 94 posts
  • Joined 12-October 07
you can use the Runas commonad from command line or you can right click on it and select runas.

if you type runas /? it will give you more information about the command.

runas /noprofile /user:mymachine\administrator cmd
this will open up a cmd window with the administrator privileges

#3
spacesurfer

spacesurfer

    Pharmassist

  • Patrons
  • 1,668 posts
  • Joined 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag
excellent tip. will see if it works. it's necessary for imagex scripts since they require admin privileges.
_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit

#4
Th3_uN1Qu3

Th3_uN1Qu3

    Digital sinner

  • Member
  • PipPipPip
  • 386 posts
  • Joined 17-March 08

you can use the Runas commonad from command line or you can right click on it and select runas.

if you type runas /? it will give you more information about the command.

runas /noprofile /user:mymachine\administrator cmd
this will open up a cmd window with the administrator privileges


It doesn't work. I get this:

Posted Image

Or am i supposed to also type in the username and computer name? If so i'll also need to find these via the command line. Besides, it says "Administrator: Command Prompt" in the title, then WHY THE HECK does it request admin permissions???

PS: The admin password is blank, i am the only user on the computer and have got admin privileges, and right-clicking and choosing "Run as administrator" works, but it STILL doesn't let me work with those files (imaadp32.acm and msadp32.acm). UAC is turned off btw.

Another edit: I found out i have to use takeown, well, i did a takeown /f on those files yet it STILL doesn't let me replace them. Takeown on the entire system32 folder doesn't work either. WTF is all this??? *fires up XP in Virtual PC, maximizes it and feels much better*

And yet another edit: I got the permissions set using the GUI, only that i've run into ANOTHER problem. The codecs that worked on XP don't work under Vista... I'm beginning to hate this.

Edited by Th3_uN1Qu3, 03 July 2008 - 07:30 PM.

What's the point of security features if we have to disable them for things to work right?

p35-ds3 / e6550 @ 3.5ghz 500fsb scythe mugen / 8gb pqi ddr2 800 @ 1000 / sapphire hd3870 / 320gb wd / x64 / nokia 920c 19"
toshi portege 4010 / p3 tualatin @ 933mhz / 512mb pc133 sdram / 16mb cyberblade / wifi / irda / sd / 30gb ibm / me / 12.1" tft
6bxds / 2x p3 @ 700mhz / 1gb cl2 sdram / sapphire 9800 pro 256mb / awe64 isa / sil3112a pci + 320gb wd / xp / thomson 24" tv

#5
DigeratiPrime

DigeratiPrime

    MSFN Junkie

  • Patrons
  • 3,550 posts
  • Joined 18-August 04
  • OS:Windows 7 x64
  • Country: Country Flag
You need to have the Secondary Logon service running in order to use 'runas'.

What exactly are you trying to accomplish? You have a game that has sound in XP but not in Vista, so you want to copy the old decoder into Vista to see if it works?

BTW you can definitely script this, but I am not sure if it will be necessary. You need to use 'takeown' and 'icacls' for example:

takeown /f %SystemRoot%\System32\imaadp32.acm
icacls %SystemRoot%\System32\imaadp32.acm /G administrators:F


Recommended Software: KeePass | Microsoft ICE | VisualWget | Vitamin D Video |




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN