4 Replies Latest reply: Oct 10, 2012 9:58 AM by Igor Alcantara RSS

    How to handle with Single Quotes in Load Script

    Igor Alcantara

      I have a code similar to this:



      For each File in Filelist ('..\source\*.csv')


           // some code here, not important for this topic


            Call ReadFile('$(File)');





      The code works fine with the file does not have single quote in the name. However, if does, the code fails when I pass the file name to the function ReadFile.


      I tried to rename the file via a macro vbscript as follows, but It also fails to pass the file name as a parameter to any function because of the single quote.

      I also try to use Chr(39), Replace and many functions but one of them works.


      Macro function:


      function renamefile(strFile)


                set fso = CreateObject("Scripting.FileSystemObject")

                newfilename = replace(strFile, chr(39), "`")

                fso.MoveFile strFile, newfilename

          set fso = Nothing

          renamefile = newfilename


      end function



      Anyone has any idea of how to solve this?