Jump to content

Copy and change name


DaLiMan
 Share

Recommended Posts

Hi,

I'm trying to make a script which copies a file to a shared folder and rename it.

But copying the file work OK, but renaming is a different story.

Here's what I have:

$message = "VCGgui file installer op S:\"

$var = FileOpenDialog($message, "P:\ProgsToRun\AutoIt\AutoIt-scripts\VCG\Output\", "Executables (*.exe)", 1 )
FileCopy($var, "S:\Daniel\VCG\",1)

Run(@ComSpec & " /c rename " & "S:\Daniel\VCG\"& $var & " SetupVCG.exe", "", @SW_HIDE)

Can someone tell me what I'm doing wrong?

Link to comment
Share on other sites

Try this, just change your last line alttle.

$message = "VCGgui file installer op S:\"

$var = FileOpenDialog($message, "P:\ProgsToRun\AutoIt\AutoIt-scripts\VCG\Output\", "Executables (*.exe)", 1 )
FileCopy($var, "S:\Daniel\VCG\",1)

Run(@ComSpec & " /c rename S:\Daniel\VCG\" & $var & " SetupVCG.exe", "", @SW_HIDE)
Link to comment
Share on other sites

Why not just have the FileCopy function rename it?

$message = "VCGgui file installer op S:\"

$var = FileOpenDialog($message, "P:\ProgsToRun\AutoIt\AutoIt-scripts\VCG\Output\", "Executables (*.exe)", 1 )
FileCopy($var, "S:\Daniel\VCG\SetupVCG.exe",1)

I am pretty sure that should work. Hope this helps!

*** Matt @ MPCS

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