Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

18 Sep 2013   #1
zarfs

Windows 7, 64-bit
 
 
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 System SpecsSystem Spec
.
18 Sep 2013   #2
redfang337

Linux Mint 15 "Olivia" x32
 
 

Did you right click the batch file and select run as Administrator?
My System SpecsSystem Spec
18 Sep 2013   #3
zarfs

Windows 7, 64-bit
 
 

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.)


Attached Images
Defrag.exe won't run from a batch file. "Insufficient permission."-batch-file-properties-window.jpg 
My System SpecsSystem Spec
.

18 Sep 2013   #4
sfxworks

Windows 7 Iltimate x64
 
 

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 System SpecsSystem Spec
24 Nov 2015   #5
zarfs

Windows 7, 64-bit
 
 
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.exe won't run from a batch file. "Insufficient permission."-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 System SpecsSystem Spec
24 Nov 2015   #6
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

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 System SpecsSystem Spec
Reply

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




Thread Tools




Similar help and support threads
Thread Forum
Batch renaming files fails, error "the system cannot find file..."
Hi all, I'm trying to rename files with batch file "bulkrename.bat", that is generated by a short program made with Visual Foxpro 9.0. Here is the source code of Foxpro program: TV recordings renamed with XML metadata tag And here is generated "bulkrename.bat": ------------------- snip...
General Discussion
General sysntax guidelines for a batch file-- "my system"
I have a precoded batch file to run in command mode. It gives commands to regedit but without my specific machine info the batch fail fails. In the sample : reg load HKLM\MY_SYSTEM and refers to this on three lines MY_SYSTEM has to refer to the Win7 being used? I tried the...
General Discussion
!!UAC!! "File Access Denied" Even with admin, as owner, and permission
First off, I wasn't sure where the best place to post this would be, since UAC is supposed to be a security feature of windows 7 I figured the security section would be best. My apologies if I posted this in the wrong section. OK to the problem... Trying to simply copy/paste a game dll file...
System Security
question - batch file only works with "unofficial" directory name
Hello... I'm using a command line batch file to backup files from my W7 Pro x64 machine to an external USB HD. Basically, "xcopy c:\......\my documents\*.*" "external HD". I couldn't get this to work until I truncated the source directory to "documents" instead of "my documents" . While the batch...
General Discussion
Folder Shared, Permission Granted File "Access denied"
On both 64Bit & 32Bit Win7 machines I get an error message, denying access to a file in a folder within another folder. All have been shared, permissions granted & drives mapped to each folder. That is in addition to initially applying the changes to the file folder, subfolders, and files. The...
Network & Sharing


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 14:36.
Twitter Facebook Google+