I'm running a bat
file from Task Scheduler
and am getting a last run result of There are no child processes to wait for. (0x80070080).
without the intended result of the script. If I run the script manually it works like a charm. It is just doing an automated git
commit
and push
. Any searching I do on the error proves to be a bit useless.
Anyone have any insight for me?
The bat
file contains the following:
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
Set hname=%COMPUTERNAME%
cd %HOME%\my_dir
git config --global user.name "Batch Script"
git config --global user.email "bat@test.com"
git add --all
git commit -m "File Backup: %mydate%_%mytime%_%hname%"
git push 2>&1
EXIT
Things I have tried:
SYSTEM
All of these result in the same error message as listed above.
| Out-Null
after 2>&1
results in the error message now being The extended attributes are inconsistent
A coworker figured it out!
The HOME
variable actually isn't defined when you are logged out. So once I explicitly defined the HOME
variable in my script, things worked perfectly.
The Fix:
I added $env:HOME = "C:\myHomePath"
before the git
commands.
User contributions licensed under CC BY-SA 3.0