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 Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
"Insufficient disk space to fix the security descriptors data stream."
Hi everybody, I've made a lot of progress with this external drive, but I seem to be stuck now. ------------------------------------------------- Unidentified problem with 3TB external drive (USB 3.0 enclosure) that the computer suddenly started treating as RAW. Spent the last two weeks...
General Discussion
Need a Batch file or similar for "detect display" in display settings.
Hi, I need a batch or similar type file that will "detect display" from (Control Panel\All Control Panel Items\Display\Screen Resolution). HP dv6 use switchable graphics and they can be seriouly problematic to update. Anyway the only way i can use the latest driver is if i put up with aero...
Performance & Maintenance
"You don't have permission to open this file."
Hey, So while trying to send my final essay to my prof for school, I go to load the file my email and then I receive this message: "You don't have permission to open this file. Contact the file owner or an administrator to obtain permission". I looked at other forums, and tried the whole ...
System Security
!!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 21:57.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App