Win 10 Startup Batchfile doesn't work

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
RobinClay
Posts: 1
Joined: 02 May 2018 04:40

Win 10 Startup Batchfile doesn't work

#1 Post by RobinClay » 02 May 2018 04:46

For about the last 20 years I've had a batch file that runs when th computer starts, and it logs the start time. But now, with Win 10,
a)
I can't get it to run on startup. I had great difficulty in creating an Autoexec.bat - and when I did, it doesn't work ! And I am also blocked from accessing my User's Start folder; and
b)
the .bat file doesn't work when I run it, but when I paste the commands into a DOS window, they each work fine !

Here are the relevant lines:-
rem ==============[ StartUp ]============
:StartUp
echo on
H:
CD H:\Belfry
path %path;H:/Belfry
REM -----------[ Start log process ]------------------
Copy C:\WINDOWS\WindowsUpdate.log StartUp /Y
dir StartUp > Scrap.txt
Find /I "StartUp" < Scrap.txt >> Use-Log.txt
REM -----------[ End log process ]----------------------------------------------------
pause
Exit

It appears that "it" doesn't recognise the FIND command in a Batch file, but will as a direct command.

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Win 10 Startup Batchfile doesn't work

#2 Post by npocmaka_ » 02 May 2018 05:53

use SCHTASKS:

Code: Select all

SCHTASKS /Create /SC ONLOGON  /TN TASK_NAME  /TR "C:\some.bat" /RU %USERNAME%  /F /RL HIGHEST
or

Code: Select all

SCHTASKS /Create /SC ONSTART  /TN TASK_NAME  /TR "C:\some.bat" /RU %USERNAME%  /F /RL HIGHEST
though to create the task you'll need a console session with admin privileges.

Post Reply