Jump to content

Recommended Posts

Posted

Hi!

i have simple exe file writed on autoit 3:

#include <Date.au3>
$logFile "alert.log"
$timestamp = "timestamp " & _Now()
 
MsgBox(0, "Info", $timestamp)
FileOpen($logFile, 2)
FileWrite($logFile, $timestamp)
FileClose($logFile)

when i start exe file manually it works, and write current timestamp to log file (alert.log), but when i start it from cmd-file (start D:\scripts\app.exe) app is starts (show me messagebox) but not write to log file.

Why? Can anybody helps me?

I tryed to run cmd as Administrator, tryed to use

runas /user:DESKTOP-D4FGH\Administrator D:\scripts\app.exe

still not works

  • Developers
Posted

Make sure you set the correct working directory first of change the lof file name to it fully qualified name including the directory....and then try again. :) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

App.au3 :

#include <Date.au3>

Local $sLogfile = "d:\scripts\alert.log" ; full path
Local $sTimestamp = "Timestamp = " & _Now()
MsgBox(BitOr(4096, 64), "Info :", $sTimestamp)

Local $hFileOpen = FileOpen($sLogfile, BitOR(2, 8)) ; 2=OVERWRITE, 8=CREATEPATH
If $hFileOpen = -1 Then Exit MsgBox(BitOr(4096, 16), "Error :", "An error occurred")
FileWrite($hFileOpen, $sTimestamp)
FileClose($hFileOpen)

CMD to start App.exe :

@echo off
CLS
cd %~dp0
Start "Info : start App.exe : " /wait "D:\scripts\app.exe"

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...