#200539 - 2010-11-08 08:55 PM
quoting
|
HeyDan
Fresh Scripter
Registered: 2010-10-29
Posts: 14
Loc: Bangkok, Thailand
|
Hi again,
I am using runnas to run a kix script. I have of course quoted the whole command line (that runnas is to execute), but I am wanting to pass a file name to the kix script, and that needs quoting too...
How is this done?
Example: runnas.exe /user:joe "KIX32.EXE kixScript.kix $passedFile=C:\something or the other.txt"
I have tried quoting the command (sent to runnas) in single quotes and it doesn't like that, and kix doesn't like it's parameters quoted in single quotes either.
Is there a way to do this? Or do I need to mess about with a temporary file to pass the name of this file?
Cheers,
Hayden
|
|
Top
|
|
|
|
#200541 - 2010-11-08 09:42 PM
Re: quoting
[Re: Mart]
|
HeyDan
Fresh Scripter
Registered: 2010-10-29
Posts: 14
Loc: Bangkok, Thailand
|
OK,
Here is a kix script:
and here is my first attempt:
runnas.exe /user:bob 'kix32.exe s.kix $pa="spider web"'
results in:
RUNNAS: The system cannot find the file specified.
So I try:
runnas.exe /user:bob "kix32.exe s.kix $pa='spider web'"
results in the kix script saying:
and then an error something like:
Error: Failed to find/open script: web'
|
|
Top
|
|
|
|
#200542 - 2010-11-08 09:43 PM
Re: quoting
[Re: HeyDan]
|
HeyDan
Fresh Scripter
Registered: 2010-10-29
Posts: 14
Loc: Bangkok, Thailand
|
XP by the way
|
|
Top
|
|
|
|
#200543 - 2010-11-08 10:27 PM
Re: quoting
[Re: HeyDan]
|
HeyDan
Fresh Scripter
Registered: 2010-10-29
Posts: 14
Loc: Bangkok, Thailand
|
For now I have written the KIX command line out to a batch file and then tell runnas to execute the batch file
|
|
Top
|
|
|
|
#200551 - 2010-11-10 02:29 AM
Re: quoting
[Re: BradV]
|
HeyDan
Fresh Scripter
Registered: 2010-10-29
Posts: 14
Loc: Bangkok, Thailand
|
Sorry, that's not possible in this situation. The problem is the spaces in the file name and I can't guarantee what the file will be called. Also, as these are auto-install scripts/exes/etc, we have used a naming scheme of:
[number for ordering]_[hardware-specific-build-name or 'all']_[hostname or 'all']_[name which is up to the person creating the install file/script/whatever]
So, 8.3 is not at all possible and proclaiming spaces and odd characters to be illegal would be unfortunate as we are using the [name] part of the file name to display in the kixForms install window, so a human readable string is preferred.
For now, writing a temporary batch file to execute the command (and then immediately deleting it) is working, but is just a messy ?solution?.
|
|
Top
|
|
|
|
#200553 - 2010-11-10 03:33 AM
Re: quoting
[Re: Les]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4567
Loc: USA
|
Am I completely missing the puzzle here? Under normal circumstances the easiest thing to do is "build" out your command line and then display it to the screen to make sure it looks like it supposed to....
$cmd='runnas.exe /user:joe KIX32.EXE kixScript.kix $passedFile="C:\something or the other.txt"'
? $cmd
;shell $cmd
|
|
Top
|
|
|
|
#200573 - 2010-11-11 04:23 AM
Re: quoting
[Re: Richard H.]
|
HeyDan
Fresh Scripter
Registered: 2010-10-29
Posts: 14
Loc: Bangkok, Thailand
|
Yeah, cmd is not the most friendly shell I have come across 
Allen: "C:\something or the other.txt" needs to be quoted as you have done, but runnas requires the whole command that it is to run to be quoted, as in (too lazy to change the internal single quotes to char() function calls):
$cmd='runnas.exe /user:joe "KIX32.EXE kixScript.kix $passedFile='C:\something or the other.txt'"'
but cmd or/and runnas does not like single quote parameter quoting
|
|
Top
|
|
|
|
#200625 - 2010-11-16 04:40 AM
Re: quoting
[Re: Allen]
|
HeyDan
Fresh Scripter
Registered: 2010-10-29
Posts: 14
Loc: Bangkok, Thailand
|
Hi ya Allen,
I think I did try that - It is the sort of thing I would try fairly early on. It seems to suggest that this might be the answer though, so maybe I mucked something else up when I tried that ... I will give it a go at some stage 
Cheers,
H
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 633 anonymous users online.
|
|
|