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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Assuming double-quotes is the only issue, this should work

sBatchID = """$$ BID=MBRORDS"""

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
use two " 's or Chr(34)

sBatchId = """$$ BID=MBRORDS"""
sBatchId = Chr(34) & "$$ BID=MBRORDS" & Chr(34)
bjshallenbergerAuthor Commented:
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.

The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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,


bjshallenbergerAuthor Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.