Jump to content

File Copy Problem


DeAgent
 Share

Recommended Posts

I am creating the installer for a program of mine but I've ran into a problem.

It is called AutoCalcInstall.Exe and I want to copy it to the C: drive

or any other drive that the user wants.

This is the problem when I write

FileCopy("AutoCalcInstall.Exe","C:\")

and try to execute the file it gives me

(File "C:\Documents and Settings\Owner\My Documents\AutoIt\AutoCalcInstall.exe"):

Error: Error in expression.

I do not know what the problem is it should work.

Can someone help me?

Edited by DeAgent
Link to comment
Share on other sites

Windows doesn't like it when programs access files that are currently in use. That is most likely the problem.

No, that's not correct.

If you compile this and run this from somewhere which is not c:\ then it will work.

msgbox(252144,"hi","It's me")
filecopy(@ScriptFullPath,"C:\installself.exe")

We need to know exactly what the error reported is to start with, and what the line used to make the copy is.

(It can't be FileCopy("AutoCalcInstall.Exe","C:\") if the user can choose the destination path.)

Maybe the destination path does not have the correct quotation marks around it to allow for spaces in the path.

Is the error really

(File "C:\Documents and Settings\Owner\My Documents\AutoIt\AutoCalcInstall.exe"):

Error: Error in expression.

? Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

$sFile = "AutoCalcInstall.Exe"

FileCopy($sFile,"C:\" & $sFile)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
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
 Share

  • Recently Browsing   0 members

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