Windows 8 batch files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Billd1959
Posts: 1
Joined: 19 Apr 2014 08:11

Windows 8 batch files

#1 Post by Billd1959 » 19 Apr 2014 09:17

I am new to writing Batch files. I have Windows 8. I am In the middle of writing a Batch file that changes my password. I just tried what I have. I tried to run It as Administrator and the program just open and close. If I just run the script It works but saids access denied so I know I need to run It as Administrator. Can you Help me? I am new here so I don't know If I can post the Batch file I am tring to write?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Windows 8 batch files

#2 Post by foxidrive » 19 Apr 2014 09:45

Yes, post your batch script here.

The problem is that running as Administrator changes the working directory to c:\windows\system32


You can put this at the start of your batch file to keep the working directory the same as where the batch file is:

Code: Select all

@echo off
cd /d "%~dp0"
:: and put your code below here


Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: Windows 8 batch files

#3 Post by Dos_Probie » 20 Apr 2014 06:21

you can also add a runas admin script at the beginning as well.

Post Reply