• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

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.
0
bjshallenberger
Asked:
bjshallenberger
2 Solutions
 
amit_gCommented:
Assuming double-quotes is the only issue, this should work

sBatchID = """$$ BID=MBRORDS"""
0
 
butch_18445Commented:
use two " 's or Chr(34)

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

Brian
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Digital_SkreamCommented:
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


0
 
RobSampsonCommented:
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.
0
 
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.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now