Link to home
Start Free TrialLog in
Avatar of bjshallenberger
bjshallenbergerFlag for United States of America

asked on

How do I include Quotation Marks (") as part of a file I need to copy?

I have an odd filename used during an FTP send to an FTP Server.  When I use an FTP GUI client, I have to upload the filename using "$$ BID=MBRORDS".  I know the quotes make this one 'word', not two with a space.

I'm trying to automate the ftp upload of this file to the server.  I'm using vbscript and having a hard time getting the quotes to be used as part of the upload process.  The line of code in question:

objShell.Run ("c:\ftp\ftp.exe -O -site DIB-4200 -u " & folderIdx.Name & " -FN " & sBatchID), 1, true

The sBatchID is defined with sBatchID = """"""$$ BID=MBRORDS"""""" .  I've tried variations of this with different degrees of failure.

The quotes have to be included in the transfer so the sight on the other end sees the filename as one word as well.

Hope I'm clear in my explanation.  Any help would be appreciated...kinda tired of working on this one.
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bjshallenberger

ASKER

I believe I've tried both of these with no luck.  I'll test with each suggestion and provide results.  Thanks for the quick response.

Brian
If all else fails, you might be able to use Chr(34) & String(2,Chr(34)) & $$ BID=MBRORDS & String(2,Chr(34)) & Chr(34)

Everything kinda goes sideways when the quotes are a part of the filename. heh heh


Hi, I'll try to put in my two cents here.....

With this:
objShell.Run ("c:\ftp\ftp.exe -O -site DIB-4200 -u " & folderIdx.Name & " -FN " & sBatchID), 1, true

whether or not you have quotes in the variable names or not, firstly you need to identify whether you have spaces.  Assuming you *do* have spaces, then on the command line, you need to pass the parameters with quotes around them in the first place, so to deal with that, you'd use

objShell.Run ("c:\ftp\ftp.exe -O -site DIB-4200 -u """ & folderIdx.Name & """ -FN """ & sBatchID & """"), 1, true

See how after -u, I added two more quotes (representing one quote inside the string), and around the -FN, and after sBatchID.  This basically translates to:
c:\ftp\ftp.exe -O -site DIB-4200 -u "C:\Some Folder" -FN "Some ID"

Now, if any of your variables also have quotes in them, you need to deal with those first, by doubling the quotes, which can be done using
Replace(sBatchID, """", """""")

So, incorporating that, try this
c:\ftp\ftp.exe -O -site DIB-4200 -u """ & folderIdx.Name & """ -FN """ & Replace(sBatchID, """", """""") & """"

Hope that helps,

Regards,

Rob.
Thanks for the helpful comments.  I changed the code back to what 'amit q' and 'butch 18445' suggested and it worked.  I wanted to make sure the code was tested and stable...all ok.  I'll split the points between you two since you got back so quickly, and only one minute apart.