jdogg
(Getting the hang of it)
2003-09-24 11:20 PM
Expand on use of quotes please

Hi.
I am using Kixtart 3.4.

I have thoroughly read through the informative post on the proper use of quotes.

I have applied this post to good use, but I would like to use more sets of quotes in a line of code.
Does the "Use Chr(34) in place of double quotes" mean use Chr(34) instead of ""?

Here is the code snippet that I am trying to use with multiple quotes. I have already applied the single quote and double quote rule.

code:
 $ADDGROUP= 'runas /u:domain\user "net localgroup administrators domain\desk techs /add" |sanur /i logon.txt' 

As you can see, I already use the outer single quotes and the inner double quotes. However, I need to put an additional set around the group name I am trying to add since it has a space in it. I am not allowed to change the group name.

Can someone help? Please let me know if I have disobeyed any forums rules. I have read them thoroughly and hope I followed them all.

Thanks!

-Jeremy

[ 24. September 2003, 23:22: Message edited by: jdogg ]


Howard Bullock
(KiX Supporter)
2003-09-24 11:25 PM
Re: Expand on use of quotes please

This should work:
code:
$ADDGROUP= 'runas /u:domain\user "net localgroup administrators \"domain\desk techs\" /add" |sanur /i logon.txt'  



ShawnAdministrator
(KiX Supporter)
2003-09-24 11:26 PM
Re: Expand on use of quotes please

Looks like RUNAS processes it's own metahcars inside the cmd string, quotes specied with /", worth a try:

? 'runas /u:domain\user "net localgroup administrators \"domain\desk techs\" /add" |sanur /i logon.txt'

-Shawn


ShawnAdministrator
(KiX Supporter)
2003-09-24 11:27 PM
Re: Expand on use of quotes please

:errrk:

Sealeopard
(KiX Master)
2003-09-24 11:28 PM
Re: Expand on use of quotes please

Too late and spelling errors in it [Eek!] ? [Big Grin] [Big Grin]

Howard Bullock
(KiX Supporter)
2003-09-24 11:31 PM
Re: Expand on use of quotes please

shawn, you working on a UNIX workstation - (/")?

code:
RUNAS [/profile] [/env] [/netonly] /user:<UserName> program

/profile if the user's profile needs to be loaded
/env to use current environment instead of user's.
/netonly use if the credentials specified are for remote access only.
/user <UserName> should be in form USER@DOMAIN or DOMAIN\USER
program command line for EXE. See below for examples

Examples:
> runas /profile /user:mymachine\administrator cmd
> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
> runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""



[ 24. September 2003, 23:32: Message edited by: Howard Bullock ]


ShawnAdministrator
(KiX Supporter)
2003-09-24 11:34 PM
Re: Expand on use of quotes please

Bloody fat fingers of mine. I was rushing to beat the two of you. What a stressfull board this is.

jdogg
(Getting the hang of it)
2003-09-25 12:38 AM
Re: Expand on use of quotes please

Thanks guys! Even the late ones... [Wink]

I am sure it will work. You guys are awesome, and freakin' quick too!

I will test it tomorrow when I am back at work and will let all of you know for sure.

-Jeremy


jdogg
(Getting the hang of it)
2003-09-25 03:20 PM
Re: Expand on use of quotes please

It worked guys! Thanks so much!
I guess the lesson learned is that on the third set of quotes (most internal), you must use \" instead of just ".

Thanks again.
-Jeremy


Howard Bullock
(KiX Supporter)
2003-09-25 03:36 PM
Re: Expand on use of quotes please

quote:
the lesson learned is that on the third set of quotes (most internal), you must use \" instead of just
Not quite correct.

The '\"' was a requirement of the runas program as documented above.

Once you have your string defined by single quotes, you can add as many double-quotes as you like.
code:
$ADDGROUP= ' "net" "localgroup" "administrators" "domain\desk techs" '
? $ADDGROUP



Peter Fry
(Getting the hang of it)
2003-09-25 04:02 PM
Re: Expand on use of quotes please

i have a simular problem

code:
  

run 'runas /env /user:sandh\$USER "copyc:\readonly\pjf0600.doc c:\test"'
sendkeys("$PASSWORD{ENTER}")

when i do this i get the following

code:
 
Running on Windows 2kEnter password for sandh\WD_ADMIN:
Attempting to start "c:\winnt\system32\copy.exe c:\readonly\pjf0600.doc c:\test" as user "sandh\WD_ADMIN"...
0
RUNAS ERROR: Unable to run - c:\winnt\system32\copy.exe c:\readonly\pjf0600.doc c:\test
2: The system cannot find the file specified.


how can i get this to work and what am i doing wrong? (sorry to highjack the post but the questions are the same (i think)


JochenAdministrator
(KiX Supporter)
2003-09-25 04:10 PM
Re: Expand on use of quotes please

That is most likely caused by the fact that copy.exe simply does not exist [Wink]

Copy is a shell intrinsic command


Howard Bullock
(KiX Supporter)
2003-09-25 04:11 PM
Re: Expand on use of quotes please

You should be starting your own thread and referencing this one.

Try:

code:
run 'runas /env /user:sandh\$USER "%comspec% /c copy c:\readonly\pjf0600.doc c:\test"'  



Peter Fry
(Getting the hang of it)
2003-09-25 04:18 PM
Re: Expand on use of quotes please

will do sorry