Windows 10: Batch file works when manually executed but only partially works when windows 10 task...

Discus and support Batch file works when manually executed but only partially works when windows 10 task... in Windows 10 Network and Sharing to solve the problem; As my title states my batch file works as intended when I execute it but if I run it through task scheduler in windows 10 it only runs part of the... Discussion in 'Windows 10 Network and Sharing' started by Only half clueless, Mar 24, 2021.

  1. Batch file works when manually executed but only partially works when windows 10 task...


    [COLOR=rgba0, 91, 106, 1]As my title states my batch file works as intended when I execute it but if I run it through task scheduler in windows 10 it only runs part of the batch file. None of the copy functions of my batch run and I just end up with an empty zip file. This issue only happens on windows 10 I have verified it on multiple systems. This started sometime in the past two weeks from what I can tell. Can any one advise on this? Here is a copy of the batch file I am running [/COLOR]


    [COLOR=rgba0, 0, 0, 1]d\cd OnPointFilesRobocopy "Z:\BOOutbox" C:\OnPointFiles\Holding PJR*.xml /MAXAGE:87za a -tzip today.zip C:\OnPointFiles\Holding\*.xmlCOPY today.zip %time:~0,2%%time:~3,2%%time:~6,2%_%date:~-10,2%%date:~-7,2%%date:~-4,4%.zipdel C:\OnPointFiles\Holding\*.xmldel C:\OnPointFiles\today.zipSET AppExePath="%ProgramFilesx86%\Insight Retail Software\IConnect"IF NOT EXIST %AppExePath% SET AppExePath="%ProgramFiles%\Insight Retail Software\IConnect"start /b "" %AppExePath%\agent.exe publish[/COLOR]

    :)
     
    Only half clueless, Mar 24, 2021
    #1
  2. jgunning Win User

    Task Scheduler Batch file

    Hi all,

    Looking for some help.Im creating a batch file to run for different users to add a scheduled task. HOWEVER - the whole thing works great and has done for some time.But after i run the batch file on each machine (different users) i have to go into the security options and change the user the task runs in to the unique user of that machine. Is there a way to use the batch file to pull the account name of the machine (or computer name) and use that as the user the task runs in?


    Thanks =)
     
    jgunning, Mar 24, 2021
    #2
  3. KenS5 Win User
    Batch file not executing commands

    I am trying to purge older files on a server and DFS. One batch file works while running a task and manually as admin, but the other does not. Below are examples of working an non working batch files.

    Commands execute:

    forfiles /P "C:\Foldername\MonthBackup" /D -30 /C "cmd /c echo %date% %time% @file @path @fdate && del @file" >> "\\domain\dfs\groups\Foldername\Backups\Logs\PurgedFilesLog.txt"

    Commands DON'T execute:

    forfiles /P "F:\groups\Foldername\Backups\MonthBackups" /S /D -30 /C "cmd /c echo %date% %time% @file @path @fdate && del @file" >> "\\domain\dfs\groups\Foldername\Backups\Logs\PurgedFilesLog.txt"

    I mapped the UNC to the F drive sine UNCs are not supported with forfiles or cmd.
     
    KenS5, Mar 24, 2021
    #3
  4. Batch file works when manually executed but only partially works when windows 10 task...

    Batch files appear to start but don't fully execute on Windows 10 Task Scheduler

    I recently set up a new system with Windows 10 Pro and copied the C:\Batch folder to the new system

    These systems are essentially identical in their hardware configuration except for the motherboard, memory & video card. ( Borh are ASUS Motherboards and Video cards with i7 Processors.)

    All drives are duplicated in size, manufactures and drive letter assignment.



    I use Robocopy in a batch file to copy files at the end of the day to a second set of hard drives on the same box.
    This has been executing perfectly on Windows 7 for years.



    When I attempt to set this up in Scheduler on Windows 10, Scheduler says it is running but there is no activity taking place.
    Task Manager and Resource Monitor bear this out not to mention the obvious that the files aren't copied across.

    When I execute this batch file from the command prompt it runs as expected.
    There are no "call" statements in the batch file.



    Example:

    Robocopy /MIR /MT:8 /R:2 /W:5 /Log:H:\!BackupLogs\BULog.txt /X /V /TEE "C:\Batch" "H:\DataBU\Batch"



    I have configured Task Scheduler as follows:



    Under General Tab I have set the user account under Security Options to the Domain user that has local admin rights.

    It is set to run whether user is logged on or not and with the highest privileges.

    Configure for Windows 10 is selected



    Triggers; it is set to run daily at 23:00:00. It is set to stop the task if it runs later than 1 day and it is enabled.



    Actions tab is set to 'Start a Program' and the full path to the batch file is correct.
    There are no arguments added and I have entered 'C:\Batch' as the 'Start In' option.



    Conditions have Start task only if on AC power and Wake computer to run this task selected.



    Settings have the following selected:

    - Allow task to be run on demand

    - Run task as soon as possible after . . .

    - Stop task if runs longer is set to 1 day

    - If the running task does not end . . . force it to stop

    And 'Do not start a new instance' is selected



    The History will show;

    - Event 107 - Task Triggered on Scheduler

    - Event 129 - Created Task Process

    - Event 100 - Task Started

    - Event 200 - Action Started



    And it will sit there until I manually stop it. I haven’t let it run for 24 hour but this task should only take seconds.

    On my W7 box, this task executes and ends in under 3 minutes daily.

    Any suggestions would be appreciated.
     
    Hawkeye007, Mar 24, 2021
    #4
Thema:

Batch file works when manually executed but only partially works when windows 10 task...

Loading...
  1. Batch file works when manually executed but only partially works when windows 10 task... - Similar Threads - Batch file works

  2. Task Scheduler is failing to execute Batch File when set to "logged in or not". This was...

    in Windows 10 BSOD Crashes and Debugging
    Task Scheduler is failing to execute Batch File when set to "logged in or not". This was...: I have a batch script that runs robocopy on a folder to archive files to a network drive, on a Windows 10 Pro machine; Note: These machines are on a domain, but have been disconnected from the domain at a client site for long time. This has not been a problem so far, but...
  3. Task Scheduler is failing to execute Batch File when set to "logged in or not". This was...

    in Windows 10 Gaming
    Task Scheduler is failing to execute Batch File when set to "logged in or not". This was...: I have a batch script that runs robocopy on a folder to archive files to a network drive, on a Windows 10 Pro machine; Note: These machines are on a domain, but have been disconnected from the domain at a client site for long time. This has not been a problem so far, but...
  4. Task Scheduler is failing to execute Batch File when set to "logged in or not". This was...

    in Windows 10 Software and Apps
    Task Scheduler is failing to execute Batch File when set to "logged in or not". This was...: I have a batch script that runs robocopy on a folder to archive files to a network drive, on a Windows 10 Pro machine; Note: These machines are on a domain, but have been disconnected from the domain at a client site for long time. This has not been a problem so far, but...
  5. Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler

    in Windows 10 Network and Sharing
    Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler: Hi there, I have created a .ps1 file which contains a RoboCopy script to copy files from a folder on my C: drive which contains a database, and paste them into a folder on my OneDrive so that they can be safely backed up to the cloud and have a history of changes.The code...
  6. Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler

    in Windows 10 Gaming
    Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler: Hi there, I have created a .ps1 file which contains a RoboCopy script to copy files from a folder on my C: drive which contains a database, and paste them into a folder on my OneDrive so that they can be safely backed up to the cloud and have a history of changes.The code...
  7. Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler

    in Windows 10 Software and Apps
    Powershell Script .ps1 file Does Not Work When Executed Through Task Scheduler: Hi there, I have created a .ps1 file which contains a RoboCopy script to copy files from a folder on my C: drive which contains a database, and paste them into a folder on my OneDrive so that they can be safely backed up to the cloud and have a history of changes.The code...
  8. Batch file works when manually executed but only partially works when windows 10 task...

    in Windows 10 Ask Insider
    Batch file works when manually executed but only partially works when windows 10 task...: As my title states my batch file works as intended when I execute it manually but if I run it through task scheduler in windows 10 it only runs part of the batch file. None of the copy functions of my batch run and I just end up with an empty zip file. This issue only happens...
  9. Task Scheduler works only when Plugged-In

    in Windows 10 Software and Apps
    Task Scheduler works only when Plugged-In: I've set up two tasks on Windows Task Scheduler, one is triggered when the device is locked and the other is triggered when the device is unlocked. But this works only when I connect my Laptop to a charger, otherwise, it doesn't work at all. I have both the tasks running on...
  10. Batch file not working

    in Windows 10 Network and Sharing
    Batch file not working: Hello, Iam making autorun project that if I plug Flash disc in my pc it autoruns batch file with my "assistant" what says Hi, what do you want? But here are things that just doesn´t work: 1.If I plug in the Flash disc autorun.inf dont do anything. 2.If I manage batch file...