1
@echo off

rem  Note: This file is an alternative launcher for DocFetcher. How to use it:
rem  1) Modify this file as needed.
rem  2) Move this file one level up into the DocFetcher folder.
rem  3) Double-click on this file to launch DocFetcher.
rem  
rem  Common modifications:
rem  1) Replace the "java" keyword in the last line with the full path to the
rem  Java executable.
rem  2) Give DocFetcher more memory with the setting -Xmx..m in the last line.
rem  For example, with -Xmx512m, DocFetcher will use up to 512 MB of memory.
rem  Using more memory than about 1 GB requires a 64-bit Java runtime.

cd %~dp0

set libclasspath=

for %%f in (.\lib\*.jar) do (call :append_classpath %%f)
goto :proceed

:append_classpath
set libclasspath=%libclasspath%;%1
goto :eof

:proceed
java -enableassertions -Xmx512m -Xss2m -cp %libclasspath% -Djava.library.path=lib net.sourceforge.docfetcher.Main %1 %2 %3 %4 %5 %6 %7 %8 %9
5
  • It works fine when "Run only when user logged on", but I need to run this without logging in. Windows 10
    – Paul
    Mar 27, 2019 at 6:20
  • I need to run this without logging in. Create separate login for to execute this task.
    – Akina
    Mar 27, 2019 at 7:16
  • First impressions: 1) The ".\lib*.jar" part has a dependency on the current directory. Do you specify the "Start In" directory in the scheduled task? If not, you might end up with a different one depending on whether the user is logged in or not. Consider specifying the "Start In" value, or consider changing the batch file to not use the ".\" notation. 2) Reduce the batch file to the smallest possible program that experiences the problem. 3) What exactly is the problem? That is, does the batch file not start; or does it generate an error; or does it not give the result you expect?
    – Doug Deden
    Mar 27, 2019 at 20:54
  • Hi Doug. 1) Yes..Start in (optional): C:\DocFetcher. This is the directory that contains the DocFetcher.bat file 2) not sure how to do this, the script was supplied by DocFetcher programmers 3) Batch file seems to start, but does not give expected result. java.exe appears in task manager, but the job hangs as if it is awaiting something. no error message, no CPU usage. Every time I start the bat file, it adds another java.exe in task manager. :(
    – Paul
    Mar 27, 2019 at 23:53
  • Hi Akina. The task is set up to use a separate administrator account with full highest privileges. I then use a different normal account to log in and test the task. eg right click run the task. When looking under Details tab in Task Manager I see three new processes appear under the admin user name (which is logged off), cmd.exe, conhost.exe and java.exe. But it hangs, no cpu usage. When running the same task but with " Run only when user is logged on" the same three appear, but function properly eg CPU usage activity and then the expected results
    – Paul
    Mar 28, 2019 at 0:12

0

You must log in to answer this question.

Browse other questions tagged .