Defrag.exe won't run from a batch file. "Insufficient permission."

zarfs

New member
Local time
7:09 PM
Messages
22
Location
Southern California USA
Defrag.exe won't run from a batch file. "Insufficient permission."

I want to defrag my C and E drives before Norton Ghost backs them up.

Norton Ghost will run a batch file before the backup, so I made a simple one:

C:\Windows\System32\Defrag.exe C: E:

It won't run, however. I get an error message saying I have "insufficient permission" to run Defrag.exe.

The permission for my user name on this file allows reading and execution. It does not permit any permission revisions, even though I have administrator status.

Any suggestions?
 

My Computer My Computer

At a glance

Windows 7, 64-bitIntel Core i3-3240 CPU @ 3.40GHz, 3404 GBIn motherboard
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Inspiron 660
OS
Windows 7, 64-bit
CPU
Intel Core i3-3240 CPU @ 3.40GHz, 340
Memory
4 GB
Graphics Card(s)
In motherboard
Sound Card
In motherboard
Monitor(s) Displays
NEC MultiSync FE992 CRT
Screen Resolution
1280 x 1024
Hard Drives
Main drive: Manufacturer not specified. Model ST500DM002-1BD142 SATA 500 GB
Supplemental drive: Maxtor 6L300S0 SATA 300 GB
Cooling
1 CPU fan, 1 chassis fan.
Keyboard
Standard
Mouse
Dell optical USB
Internet Speed
11 Mb/sec
Antivirus
Norton Internet Security 20.4.0.40
Browser
Firefox
Did you right click the batch file and select run as Administrator?
 

My Computer My Computer

At a glance

.
Computer type
PC/Desktop
OS
.
When I double-click the batch file itself, what appears to be a small command-prompt window appears and disappears almost instantly.

When I bring up the batch file properties, the box for "Run as administrator" is grayed out. (See attachment.)
 

Attachments

  • Batch file properties window.jpg
    Batch file properties window.jpg
    35 KB · Views: 20

My Computer My Computer

At a glance

Windows 7, 64-bitIntel Core i3-3240 CPU @ 3.40GHz, 3404 GBIn motherboard
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Inspiron 660
OS
Windows 7, 64-bit
CPU
Intel Core i3-3240 CPU @ 3.40GHz, 340
Memory
4 GB
Graphics Card(s)
In motherboard
Sound Card
In motherboard
Monitor(s) Displays
NEC MultiSync FE992 CRT
Screen Resolution
1280 x 1024
Hard Drives
Main drive: Manufacturer not specified. Model ST500DM002-1BD142 SATA 500 GB
Supplemental drive: Maxtor 6L300S0 SATA 300 GB
Cooling
1 CPU fan, 1 chassis fan.
Keyboard
Standard
Mouse
Dell optical USB
Internet Speed
11 Mb/sec
Antivirus
Norton Internet Security 20.4.0.40
Browser
Firefox
if you can edit the batch file,
or here do this

open notepad
drag and drop the batch file into the text editor
on the last line, put "pause" without quotes
run it
screenshot it
post it here
 

My Computer My Computer

At a glance

Windows 7 Iltimate x64
OS
Windows 7 Iltimate x64
I want to try again

I gave up on this but now want to try again.

Here's the batch file:
@echo off
C:\Windows\System32\Defrag.exe /E D: /U
echo.
echo.
echo =========
echo D O N E
echo =========
echo.
echo.
echo.
pause
Here's what I get in Command Prompt when I run the batch file:

Defrag screen shot 1.jpg

The batch file runs fine when I right click it and click "Run as administrator," but I want to run it automatically when the batch file is called from Norton Ghost.

Is there a command I can include in the batch file that will make it run on its own?
 

My Computer My Computer

At a glance

Windows 7, 64-bitIntel Core i3-3240 CPU @ 3.40GHz, 3404 GBIn motherboard
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Inspiron 660
OS
Windows 7, 64-bit
CPU
Intel Core i3-3240 CPU @ 3.40GHz, 340
Memory
4 GB
Graphics Card(s)
In motherboard
Sound Card
In motherboard
Monitor(s) Displays
NEC MultiSync FE992 CRT
Screen Resolution
1280 x 1024
Hard Drives
Main drive: Manufacturer not specified. Model ST500DM002-1BD142 SATA 500 GB
Supplemental drive: Maxtor 6L300S0 SATA 300 GB
Cooling
1 CPU fan, 1 chassis fan.
Keyboard
Standard
Mouse
Dell optical USB
Internet Speed
11 Mb/sec
Antivirus
Norton Internet Security 20.4.0.40
Browser
Firefox
Welcome back Zarfs,

You might want to take a look at my selection of "Run as Administrator" lines found here. Saves you having to right click. You'll need to accept the UAC dialogue though.
 

My Computer My Computer

At a glance

Windows 10, Windows 8.1 Pro, Windows 7 Profes...
Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Back
Top