Page 1 of 1 1
Topic Options
#28667 - 2002-09-09 04:56 PM Use of Quotes in Shell Command
8bit Offline
Fresh Scripter

Registered: 2002-06-21
Posts: 21
Loc: Bristol / UK
I've got this shell command and it's just not working. I'm staring at the single and double quotes, I know I've gone wrong somewhere but I just can't see it.

The following line works a treat when reading through an array containing files to copy:

code:
Shell '%COMSPEC% /c xcopy.exe /Q /D "'+@LDRIVE+$ContactSpecific+'\'+$AcdServices[$Counter]+'" $AcdDirectory > nul'  


But this next one which uses wildcards screws up and I guess i've got the quotes wrong?

code:
 

Shell '%COMSPEC% /C xcopy.exe /Q /D "'+@LDRIVE+$CCBristolStart+'\*.*'" $LCCopsStartDir > nul'


Can anyone tell me where I'm going wrong in the second example? I think I'm suffering from "Kix Fever", I've spent far too long developing this logon script and I'm starting to loose the plot!!!

Top
#28668 - 2002-09-09 05:00 PM Re: Use of Quotes in Shell Command
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Does the directory in $LCCopsStartDir have spaces in the name? If so, add double quotes around the variable.

Also, I think you have an extra single quote '" before this var . Should be:'\*.*"

{edit}
or
code:
Shell '%COMSPEC% /C xcopy.exe /Q /D "' + @LDRIVE + $CCBristolStart + '\*.*" "' + $LCCopsStartDir + '" > nul'



[ 09. September 2002, 17:19: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#28669 - 2002-09-09 07:14 PM Re: Use of Quotes in Shell Command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You should also put the complete shell command into a string and the call SHELL with that string. you cna then displat the string and look whether there are incorrect quotes.
code:
$shellcommand = '%COMSPEC% /C xcopy.exe /Q /D "'+@LDRIVE+'\'+$CCBristolStart+'\*.*"'+ $LCCopsStartDir + ' > nul'  
? 'Executing SHELL command : '+$shellcommand
shell $shellcommand

_________________________
There are two types of vessels, submarines and targets.

Top
#28670 - 2002-09-09 07:40 PM Re: Use of Quotes in Shell Command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Agreed! See the FAQs

Topic: Not quite everything you wanted to know about RUN and SHELL

Topic: Proper use of quotes

One other point.  When trying to display the string to the console, you may need to modify default behaviour for WrapAtEOL.

SetOption("WrapAtEOL","On")
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#28671 - 2002-12-04 09:33 PM Re: Use of Quotes in Shell Command
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Another way of checking f.e. missing quotations is by using our tool
kixstrip, which you can find on our site.
With the call
kixstrip input.kix output.kix /block_check
we get following output
code:
 SHELL '%COMSPEC% /c xcopy.exe /Q /D "'+@ldrive+$contactspecific+'\'+$acdservices[$counter]+'" $AcdDirectory > nul'
SHELL '%COMSPEC% /C xcopy.exe /Q /D "'+@ldrive+$ccbristolstart+'\*.*'" $LCCopsStartDir > nul'

;($begin)
;
; wed 04-dec-2002 21:35:06 (kix 4.10 vs 3.20e)
;
;Warning KIXSTRIP: 1 line is incompleted.
; rerun program with option "/block_check /show_errors".
;Warning KIXSTRIP: some lines contains errors or possible errors.
; 1 line incomplete "double quotation".
; 1 line incompleted.
;Informative KIXSTRIP: no block_structures found.
;Informative KIXSTRIP: no UDF's found.
;Informative KIXSTRIP: no labels found.
;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE
;Informative KIXSTRIP: 2 SHELL
;
;($end)
;($begin)
;
;Warning KIXSTRIP: 2 line incomplete "double quotation".
;Warning KIXSTRIP: 2 line incompleted.
;
;($end)

greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#28672 - 2002-12-04 09:41 PM Re: Use of Quotes in Shell Command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
still, with kixstrip one should note that the warning about quotation marks does not always mean that there is something wrong [Wink]
_________________________
!

download KiXnet

Top
#28673 - 2002-12-04 09:43 PM Re: Use of Quotes in Shell Command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
...nor does the lack of warning imply that all is well.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 363 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.075 seconds in which 0.036 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org