dbTalk Databases Forums  

Variable in Shell with quotes

comp.databases.ms-access comp.databases.ms-access


Discuss Variable in Shell with quotes in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
stevenrec
 
Posts: n/a

Default Variable in Shell with quotes - 01-16-2012 , 04:55 AM






hi,

Have a problem that I have not been able to correct.

Attempting to create a shell to run

"C:\Program Files\Remote Control Viewer\RCViewer\isscntr.exe" -
a"comp_name" -c"Remote Control"
where comp_name is a string variable (i.e. LTDE562541 or PCDE845496
etc)

the quotes are needed

have been unable to create a string with the quotes, keep getting
"unexpected end"

am getting confusted with trying to get quotes within quotes

Help? Please

Thanks

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Variable in Shell with quotes - 01-16-2012 , 05:27 AM






stevenrec wrote:
Quote:
hi,

Have a problem that I have not been able to correct.

Attempting to create a shell to run

"C:\Program Files\Remote Control Viewer\RCViewer\isscntr.exe" -
a"comp_name" -c"Remote Control"
where comp_name is a string variable (i.e. LTDE562541 or PCDE845496
etc)

the quotes are needed

have been unable to create a string with the quotes, keep getting
"unexpected end"

am getting confusted with trying to get quotes within quotes

To make a quote be a literal character instead of a string delimiter, you
have to "escape" it.In the "basic" languages, VB, VBA and vbscript, that
requires you to double the character. To get you started, look at this:

sCmd= """C:\Program Files\Remote Control Viewer\RCViewer\isscntr.exe"""
debug.print sCmd

When you run this in the VBA editor, you will see
"C:\Program Files\Remote Control Viewer\RCViewer\isscntr.exe"
appear in the Immediate window.

Now, the task is to concatenate the value contained in comp_name into your
sCmd variable:
sCmd=sCmd & " -a""" & comp_name & """'
debug.print sCmd

The last part should be easy for you so I will leave it for you to do.

Reply With Quote
  #3  
Old   
stevenrec
 
Posts: n/a

Default Re: Variable in Shell with quotes - 01-16-2012 , 06:07 AM



Thanks

used your info and made it work

shelltxt = """C:\Program Files\Remote Control Viewer\RCViewer
\isscntr.exe"""
shelltxt = shelltxt & " -a""" & findit & """" & " -c""Remote
Control"""

Call Shell(shelltxt, 1)

there are too many quotes to count, hard to even read on screen

now know why I usually just use a .cmd file for most shell commands

thanks again

Reply With Quote
  #4  
Old   
Stuart McCall
 
Posts: n/a

Default Re: Variable in Shell with quotes - 01-16-2012 , 10:59 PM



"stevenrec" <steven (AT) stevenrec (DOT) com> wrote

Quote:
Thanks

used your info and made it work

shelltxt = """C:\Program Files\Remote Control Viewer\RCViewer
\isscntr.exe"""
shelltxt = shelltxt & " -a""" & findit & """" & " -c""Remote
Control"""

Call Shell(shelltxt, 1)

there are too many quotes to count, hard to even read on screen

now know why I usually just use a .cmd file for most shell commands

thanks again
You may find this way to be more convenient/readable:

Const qt = """"

shelltxt = qt & "C:\Program Files\Remote Control
Viewer\RCViewer\isscntr.exe" & qt

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.