2

If I run c:\myfile.exe from cmd prompt it works and loads its config file properly. But the same thing using AutoIt has the program start, but then ignores its config file:

Run("c:\myfile.exe")

Why doesn't it run correctly like it does from cmd prompt ?

user4157124
  • 2,809
  • 13
  • 27
  • 42
Francky
  • 67
  • 1
  • 7
  • 1
    Without knowing what "myfile.exe" does it's impossible to tell. Look for logs, some output or other traces of its activity. As a blind guess, look for startup directory differences. – Alejandro Dec 20 '17 at 16:53
  • myfile.exe is a monero miner. I try to build an autoit script wich will restart my miner depnding of my computer activity (idle or not). If I launch myminer from cmd, it works and load the configfile.txt, but the if I do exact same thing with autoit (Run....), my miner open but without the config file loaded. – Francky Dec 20 '17 at 16:56

2 Answers2

2

Helpfile shows:

Run ( "program" [, "workingdir" [, show_flag [, opt_flag]]] )

Set the "workingdir" (path to the config file). Your "program" searches in the working directory for its config file. It defaults to the AutoIt script's working directory, which equals @ScriptDir.

Following your example, it should be:

Run("C:\myfile.exe", "C:\")
user4157124
  • 2,809
  • 13
  • 27
  • 42
Stephan
  • 53,940
  • 10
  • 58
  • 91
0

does running it from cmd, rather than executing it directly, result in the expected behavior?

Run("cmd /c c:\myfile.exe")

or

Run(@ComSpec &  " /c c:\myfile.exe")
iamtheky
  • 134
  • 1
  • 1
  • 3