Jump to content

Recommended Posts

Posted

hello

i am using this line to copy files

$command = ' /AutoIt3ExecuteLine "Exit(FileCopy(''' & $master_sorted_array[$x][0] & ''', ''' & $target_dir & '''))"'

RunWait(@AutoItExe & $command)

however i am coming across a problem when the file path contains a single quote

any idea how to get around that?

thank you in advance!

Posted

i am also trying to FileRecycle some files same issue of course.. here are the output messages...

consolewrite

Quote

/AutoIt3ExecuteLine "Exit(FileRecycle('C:\Users\Smith\Desktop\New folder1\m's pics\20151229_160630 - Copy.jpg'))"

error

Quote

Exit(FileRecycle('C:\Users\Smith\Desktop\New folder1\m's pics\20151229_160630 - Copy.jpg'))

Exit(FileRecycle('C:\Users\Smith\Desktop\New folder1\m's pics^ERROR

Error: Unable to parse line.

 

  • Developers
Posted

mmm 2000+ posts and still looking for the basics. ;)

Exit(FileRecycle("C:\Users\Smith\Desktop\New folder1\m's pics\20151229_160630 - Copy.jpg"))

 

1 hour ago, gcue said:

it is definitely the single quote found in file paths bc that's where i get a parsing error

Show the content of the variable so I can see what it contains.

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

Posted

Hello. This should work.

 

Local $command = ' /AutoIt3ExecuteLine "Exit(FileCopy(' & _Quoted($master_sorted_array[$x][0]) & ',' & _Quoted($target_dir ) & '))"'

RunWait(@AutoItExe & $command)

Func _Quoted($sString)
    Return '""' & $sString & '""'
EndFunc   ;==>_Quoted

Saludos

Posted
14 minutes ago, Danyfirex said:

Hello. This should work.

 

Local $command = ' /AutoIt3ExecuteLine "Exit(FileCopy(' & _Quoted($master_sorted_array[$x][0]) & ',' & _Quoted($target_dir ) & '))"'

RunWait(@AutoItExe & $command)

Func _Quoted($sString)
    Return '""' & $sString & '""'
EndFunc   ;==>_Quoted

Saludos

genius idea!  

works great!

muchas gracias!

Posted
22 minutes ago, Jos said:

mmm 2000+ posts and still looking for the basics. ;)

Exit(FileRecycle("C:\Users\Smith\Desktop\New folder1\m's pics\20151229_160630 - Copy.jpg"))

 

Show the content of the variable so I can see what it contains.

Jos

i dont think its basic at all.  there's a mix and possibility of single and double quotes and i wanted to make sure i was able to capture the possibilities.

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