Task Scheduling With Batch File Question


  1. Posts : 23
    Windows 7 Ultimate x64
       #1

    Task Scheduling With Batch File Question


    Hi everyone,

    I've recently been setting up some automation via TS with great success, until now.

    I want it to delete daily all content, sub folders and files etc from my TV shows parent folder.

    I am using the following shell script (.cmd batch file)

    @echo off
    setlocal enableextensions
    if {%1}=={} goto :HELP
    if {%1}=={/?} goto :HELP
    goto :START

    :HELP
    echo Usage: %~n0 directory-name
    echo.
    echo Empties the contents of the specified directory,
    echo WITHOUT CONFIRMATION. USE EXTREME CAUTION!
    goto ONE

    :START
    pushd %1 || goto ONE
    rd /q /s . 2> NUL
    popd

    ONE
    endlocal


    from this link Create Batch file to delete files and subfolders, but not root folder

    I have it set up thus "C:\Scripts\CleanDir.cmd" \\Users\Administrator\Downloads\Deluge Completed in TS, and it has set everything after the commas as the argument.

    It runs, it provides the result (0x1 the same as other tasks that do work), but nothing is deleted.

    Can any more experienced user tell me what i'm doing wrong please? I'm guessing it's a comma or gap thing, something simple!
      My Computer


  2. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #2

    Are you running the .BAT file with elevated (administrator) privileges?
      My Computer


  3. Posts : 23
    Windows 7 Ultimate x64
    Thread Starter
       #3

    No! Only logged in as administrator with full power so that may be it , I'll try tonight thanks.
      My Computer


  4. Posts : 23
    Windows 7 Ultimate x64
    Thread Starter
       #4

    Drat, this has not fixed it, restarted just to be sure.
      My Computer


  5. Posts : 23
    Windows 7 Ultimate x64
    Thread Starter
       #5

    Sorted it using 3rd party software in the end.
      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 06:16.
Find Us