Page 1 of 1 1
Topic Options
#46018 - 2003-09-24 11:20 PM Expand on use of quotes please
jdogg Offline
Getting the hang of it

Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
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 ]

Top
#46019 - 2003-09-24 11:25 PM Re: Expand on use of quotes please
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
This should work:
code:
$ADDGROUP= 'runas /u:domain\user "net localgroup administrators \"domain\desk techs\" /add" |sanur /i logon.txt'  

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46020 - 2003-09-24 11:26 PM Re: Expand on use of quotes please
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
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

Top
#46021 - 2003-09-24 11:27 PM Re: Expand on use of quotes please
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
:errrk:
Top
#46022 - 2003-09-24 11:28 PM Re: Expand on use of quotes please
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Too late and spelling errors in it [Eek!] ? [Big Grin] [Big Grin]
_________________________
There are two types of vessels, submarines and targets.

Top
#46023 - 2003-09-24 11:31 PM Re: Expand on use of quotes please
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46024 - 2003-09-24 11:34 PM Re: Expand on use of quotes please
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bloody fat fingers of mine. I was rushing to beat the two of you. What a stressfull board this is.
Top
#46025 - 2003-09-25 12:38 AM Re: Expand on use of quotes please
jdogg Offline
Getting the hang of it

Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
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

Top
#46026 - 2003-09-25 03:20 PM Re: Expand on use of quotes please
jdogg Offline
Getting the hang of it

Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
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

Top
#46027 - 2003-09-25 03:36 PM Re: Expand on use of quotes please
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
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

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46028 - 2003-09-25 04:02 PM Re: Expand on use of quotes please
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
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)

Top
#46029 - 2003-09-25 04:10 PM Re: Expand on use of quotes please
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
That is most likely caused by the fact that copy.exe simply does not exist [Wink]

Copy is a shell intrinsic command
_________________________



Top
#46030 - 2003-09-25 04:11 PM Re: Expand on use of quotes please
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
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"'  

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46031 - 2003-09-25 04:18 PM Re: Expand on use of quotes please
Peter Fry Offline
Getting the hang of it

Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
will do sorry
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
0 registered and 515 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.062 seconds in which 0.023 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