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


  1. Posts : 22
    Windows 7, 64-bit
       #1

    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


  2. Posts : 467
    Linux Mint 15 "Olivia" x32
       #2

    Did you right click the batch file and select run as Administrator?
      My Computer


  3. Posts : 22
    Windows 7, 64-bit
    Thread Starter
       #3

    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 Thumbnails Attached Thumbnails Defrag.exe won't run from a batch file. "Insufficient permission."-batch-file-properties-window.jpg  
      My Computer


  4. Posts : 30
    Windows 7 Iltimate x64
       #4

    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


  5. Posts : 22
    Windows 7, 64-bit
    Thread Starter
       #5

    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 Computer


  6. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #6

    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


 

  Related Discussions
Our Sites
Site Links
About 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 15:03.
Find Us