Batch script -> Access Denied to C:\Windows\

Got another question to this: I have a .bat file I am trying to run from a hyperlink. I have a shortcut to the .bat file with "Administrator" checked and the .bat file runs fine from the shortcut, but still looks for privileges when run from the hyperlink. I do no want to use "runas" because it "requires" a password and there may not be one.
 

My Computer

System One

  • OS
    Windows 8 Pro
    System Manufacturer/Model
    Dell Inspiron 1750
    CPU
    Duo Core 2.5 G HZ
Batch files do not, by themselves, require any special privileges. It's what the batch file does that requires them. Without knowing what it does, we have no idea what the problem is.
 

My Computer

System One

  • OS
    Windows 8.1 Pro
    CPU
    Intel i7 3770K
    Motherboard
    Gigabyte Z77X-UD4 TH
    Memory
    16GB DDR3 1600
    Graphics Card(s)
    nVidia GTX 650
    Sound Card
    Onboard Audio
    Monitor(s) Displays
    Auria 27" IPS + 2x Samsung 23"
    Screen Resolution
    2560x1440 + 2x 2048x1152
    Hard Drives
    Corsair m4 256GB, 2 WD 2TB drives
    Case
    Antec SOLO II
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    Logitech MX
Here is the .bat file:

powercfg /Hibernate on
C:\Windows\System32\Rundll32.exe powrprof.dll,SetSuspendState Hibernate
 

My Computer

System One

  • OS
    Windows 8 Pro
    System Manufacturer/Model
    Dell Inspiron 1750
    CPU
    Duo Core 2.5 G HZ
Ok, you're enabling the hibernation file. This requires administrator privileges. I do not know what you mean by "run from the hyperlink", but you cannot run this command without having administrator privileges.
 

My Computer

System One

  • OS
    Windows 8.1 Pro
    CPU
    Intel i7 3770K
    Motherboard
    Gigabyte Z77X-UD4 TH
    Memory
    16GB DDR3 1600
    Graphics Card(s)
    nVidia GTX 650
    Sound Card
    Onboard Audio
    Monitor(s) Displays
    Auria 27" IPS + 2x Samsung 23"
    Screen Resolution
    2560x1440 + 2x 2048x1152
    Hard Drives
    Corsair m4 256GB, 2 WD 2TB drives
    Case
    Antec SOLO II
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    Logitech MX
Ok, you're enabling the hibernation file. This requires administrator privileges. I do not know what you mean by "run from the hyperlink", but you cannot run this command without having administrator privileges.

<a href="../core/Hibernate.bat.lnk"><img src="../img/Hibernate.png" border="0" width="20" height="20" alt="Hibernate"></a>
 

My Computer

System One

  • OS
    Windows 8 Pro
    System Manufacturer/Model
    Dell Inspiron 1750
    CPU
    Duo Core 2.5 G HZ
I don't really understand what you're doing. That's a web page. Are you trying to run the batch file on the local computer or on the web server?

Assuming you want local, this will download the lnk file, which points to a location that is valid on the server. It's unlikely the client has a batch file in that same location with the same name.

IE runs in protected mode, which prevents it from executing anything that requires administrator privileges. The "Administrator" checkbox is metadata, and is only valid on the computer it was created on.
 

My Computer

System One

  • OS
    Windows 8.1 Pro
    CPU
    Intel i7 3770K
    Motherboard
    Gigabyte Z77X-UD4 TH
    Memory
    16GB DDR3 1600
    Graphics Card(s)
    nVidia GTX 650
    Sound Card
    Onboard Audio
    Monitor(s) Displays
    Auria 27" IPS + 2x Samsung 23"
    Screen Resolution
    2560x1440 + 2x 2048x1152
    Hard Drives
    Corsair m4 256GB, 2 WD 2TB drives
    Case
    Antec SOLO II
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    Logitech MX
Not a webpage, it is a desktop gadget that controls sleep and hibernate modes. Hibernate has to be enabled (on) for "Hibernate" and disabled (off) for "Sleep". The hyperlink opens the shortcut that has "Administrator" checked, that opens the batch file with the command in it. Double clicking the shortcut runs fine, it is the hyperlink that fails.
 

My Computer

System One

  • OS
    Windows 8 Pro
    System Manufacturer/Model
    Dell Inspiron 1750
    CPU
    Duo Core 2.5 G HZ
Windows 8 doesn't have gadgets.
 

My Computer

System One

  • OS
    Windows 8.1 Pro
    CPU
    Intel i7 3770K
    Motherboard
    Gigabyte Z77X-UD4 TH
    Memory
    16GB DDR3 1600
    Graphics Card(s)
    nVidia GTX 650
    Sound Card
    Onboard Audio
    Monitor(s) Displays
    Auria 27" IPS + 2x Samsung 23"
    Screen Resolution
    2560x1440 + 2x 2048x1152
    Hard Drives
    Corsair m4 256GB, 2 WD 2TB drives
    Case
    Antec SOLO II
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    Logitech MX
So maybe you should talk to the author of that then. Or on the Windows 7 support boards. Windows 8 removed Gadgets due to security issues, and you're probably dealing with such issues.
 

My Computer

System One

  • OS
    Windows 8.1 Pro
    CPU
    Intel i7 3770K
    Motherboard
    Gigabyte Z77X-UD4 TH
    Memory
    16GB DDR3 1600
    Graphics Card(s)
    nVidia GTX 650
    Sound Card
    Onboard Audio
    Monitor(s) Displays
    Auria 27" IPS + 2x Samsung 23"
    Screen Resolution
    2560x1440 + 2x 2048x1152
    Hard Drives
    Corsair m4 256GB, 2 WD 2TB drives
    Case
    Antec SOLO II
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    Logitech MX
The author is not responsible for Win8 security levels, that is native to the OS.
 

My Computer

System One

  • OS
    Windows 8 Pro
    System Manufacturer/Model
    Dell Inspiron 1750
    CPU
    Duo Core 2.5 G HZ
I guess I should have said that I have tested this under "Default Administrator" and it works....
 

My Computer

System One

  • OS
    Windows 8 Pro
    System Manufacturer/Model
    Dell Inspiron 1750
    CPU
    Duo Core 2.5 G HZ
Back
Top