Jump to content
Sign in to follow this  
davidsinko

.exe parameters won't work with FileWrite!?

Recommended Posts

Until now I had no problems using .exe parameters. But when I write a script where I write something in .txt file, it won't work 🙄

For example:
$var = $CmdLine[1]
FileWrite("datamatrix.txt", $var)

does not write anything to datamatrix.txt.

Even if I try something like this:
$var = $CmdLine[1]
FileWrite("datamatrix.txt", "This is an example.")

it doesn't write "This is an example." in datamatrix.txt.

But if I remove "$CmdLine[1]" from my code then I can write whatever I want to the datamatrix.txt. Is this a bug?🙄

 

Thanks 😊

Share this post


Link to post
Share on other sites

Well if I run .exe by double-clicking I get an error because there are no parameters. But if I enter a parameter through command line nothing happens - it just won't write to the file. I wrote a test program that shows the written parameter in a separate window, and that works.

Share this post


Link to post
Share on other sites
22 minutes ago, davidsinko said:

I tought the files are always being created there where the .exe file exists.

No, "of course not", they are created in your case relative to the Working Directory (@workdir). :) 
So just make the file fully qualified and you should be in business. The easiest way is:

FileWrite(@scriptdir & "\datamatrix.txt", $var)

Jos


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.
  :)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...