Batch file does not execute correctly

devilhacker Posted messages 625 Status Member -  
devilhacker Posted messages 625 Status Member -
Hello, I made a small batch file to launch an executable. I create a scheduled task, but when it runs it doesn’t execute completely—in other words, I do get a Command Prompt process that starts, but not the actual exe. My code is:
@echo off
set "workdir=%~dp0"
pushd "%workdir%"
xmr-stak.exe
exit
I should note that if I double-click the bat, it works fine... anything special to put in the scheduled task? I had tested this:
@echo off
START xmr-stak.exe
exit
But with double-click it leaves a DOS window open... and still didn’t run in the scheduled task either. I’m stuck... any ideas? thanks

6 answers

  1. wifi38 Posted messages 153 Registration date   Status Member Last intervention   61
     
    Hi,

    With no guarantee that it will work for you,

    The only trick I found for my account is to place the .bat file in c:\windows\system32 with the executable in question, but in your case I think you should place the .bat file in the folder that hosts xmr-stak.exe

    To test.

    Best regards
    0
    1. devilhacker Posted messages 625 Status Member 99
       
      Hello, thank you for your reply. Exactly, the .bat file is located in the folder of xmr-stak.exe... that's what I don't understand. I haven't tested putting it in System32. then I don't know if it matters but this .exe file needs a config text file to work... so is that the problem? I don't think so but oh well...
      0
  2. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 659
     
    hello
    try with the full path
    \chemin\xmr-stak.exe
    0
  3. devilhacker Posted messages 625 Status Member 99
     
    well so i found out why... basically i had to specify in the file where to start the script... the test is ok when i tell it to start at session startup. i converted it to .exe and it works too.

    i run a test by putting in the parameters to start at pc startup... it doesn’t start...

    i change the condition again and i set that it must start when the pc is idle... it doesn’t work... i reset the parameter to start at session startup and it works...

    aaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhh....


    plus dans le récap des taches j’ai une erreur 0x1....

    any ideas?
    0
  4. wifi38 Posted messages 153 Registration date   Status Member Last intervention   61
     
    Hi,

    It might be a Windows 10 security issue; in your case, the control must be total for everyone for the considered directory or directories.

    To try to see.

    Best regards.
    0
    1. devilhacker Posted messages 625 Status Member 99
       
      I put in the first tab "run with maximum permissions" and its function works when asked to open at logon. but as soon as you change the conditions it stops working... basically my goal is for it to run when the PC is idle. but it doesn't work. the same for the startup option also doesn't work... whereas at logon it does... I don't understand anything anymore.
      0
  5. wifi38 Posted messages 153 Registration date   Status Member Last intervention   61
     
    Hi,

    Is it by any chance that in the scheduled task properties, the tab "only allow if the user is connected" hasn't remained checked?

    After that I'm stuck.

    Best regards
    0
    1. devilhacker Posted messages 625 Status Member 99
       
      no, it’s not checked off :( plus it’s an auto session without a password either…. ugh why does it work on startup but not when we request in idle for example… I don’t get it here…
      0