#46018 - 2003-09-24 11:20 PM
Expand on use of quotes please
|
jdogg
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
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'
|
Top
|
|
|
|
#46022 - 2003-09-24 11:28 PM
Re: Expand on use of quotes please
|
Sealeopard
KiX Master
Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
|
|
Top
|
|
|
|
#46023 - 2003-09-24 11:31 PM
Re: Expand on use of quotes please
|
Howard Bullock
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 ]
|
Top
|
|
|
|
#46025 - 2003-09-25 12:38 AM
Re: Expand on use of quotes please
|
jdogg
Getting the hang of it
Registered: 2003-09-11
Posts: 91
Loc: RTP, North Cakalaka, USA
|
Thanks guys! Even the late ones...
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
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
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
|
Top
|
|
|
|
#46028 - 2003-09-25 04:02 PM
Re: Expand on use of quotes please
|
Peter Fry
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
|
|
|
|
#46030 - 2003-09-25 04:11 PM
Re: Expand on use of quotes please
|
Howard Bullock
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"'
|
Top
|
|
|
|
#46031 - 2003-09-25 04:18 PM
Re: Expand on use of quotes please
|
Peter Fry
Getting the hang of it
Registered: 2001-07-23
Posts: 95
Loc: Bristol UK
|
will do sorry
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 515 anonymous users online.
|
|
|