Jump to content

Run command - escape quote marks...


 Share

Recommended Posts

Hi

I'm writing a backup script and it's working pretty well.

I'm trying to get it to send a confirmation e-mail once it's finished and for that I'm using a command line SMTP tool called BMail.

My code at the moment is...

;SEND CONFIRMATION E-MAIL
Run ("C:\admin\bmail.exe -s smtp.domain.com -f 
from@email.com -t to@email.com -h -a 
"Backup completed successfully" -b "Backup completed successfully" ")

But obviously that causes a parse error at runtime because of the "" quote marks around some of the statements in the command.

In order to have spaces in the subject and e-mail body, I have to have quote marks around the text after the -a (subject) and -b (body) switches.

How do I do this?

I've tried escaping them and I still get the parse error.

I've tried converting them to apostrophes but the command just sends the apostrophe and the first word up until the space.

I don't want to have to open a command box and send the keystrokes of the command unless there's no other way.

Any ideas?

Thanks

Batfastad

Link to comment
Share on other sites

Try replacing the outermost ones (only) with apostrophes ..

;SEND CONFIRMATION E-MAIL
Run ('C:\admin\bmail.exe -s smtp.domain.com -f from@email.com -t to@email.com -h -a "Backup completed successfully" -b "Backup completed successfully" ')

.. and just in case: make sure the Run() is all on one line, as you haven't used any line-continuations ("_")

Link to comment
Share on other sites

Hi

I'm writing a backup script and it's working pretty well.

I'm trying to get it to send a confirmation e-mail once it's finished and for that I'm using a command line SMTP tool called BMail.

My code at the moment is...

;SEND CONFIRMATION E-MAIL
Run ("C:\admin\bmail.exe -s smtp.domain.com -f 
from@email.com -t to@email.com -h -a 
"Backup completed successfully" -b "Backup completed successfully" ")

But obviously that causes a parse error at runtime because of the "" quote marks around some of the statements in the command.

In order to have spaces in the subject and e-mail body, I have to have quote marks around the text after the -a (subject) and -b (body) switches.

How do I do this?

I've tried escaping them and I still get the parse error.

I've tried converting them to apostrophes but the command just sends the apostrophe and the first word up until the space.

I don't want to have to open a command box and send the keystrokes of the command unless there's no other way.

Any ideas?

Thanks

Batfastad

<{POST_SNAPBACK}>

;SEND CONFIRMATION E-MAIL
Run ('C:\admin\bmail.exe -s smtp.domain.com -f 
from@email.com -t to@email.com -h -a 
"Backup completed successfully" -b "Backup completed successfully" ')

OR

;SEND CONFIRMATION E-MAIL
Run ("C:\admin\bmail.exe -s smtp.domain.com -f 
from@email.com -t to@email.com -h -a 
""Backup completed successfully"" -b ""Backup completed successfully"" ")

DOH!....you beat me to it Trids :idiot:

Edited by pacman
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...