Re: runas: need help with those quotes
- From: jrsmoots <jrsmoots@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 May 2009 16:38:01 -0700
Thanks! I'll try it out :)
I too thought it weird that there is no space after: -custom , but that''s
a copy/paste directly from the windows shortcut.
Assuming there is no space after the -custom , should I do:
& " -custom""C:\Documents...
....wherein custom is butted up against the "C:\Documents....
Thanks again!
"Richard Mueller [MVP]" wrote:
.
"jrsmoots" <jrsmoots@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5AF9724E-E77A-452E-B473-9B84F73FB370@xxxxxxxxxxxxxxxx
I'm working on a script for a customer that will allow Install Shield to
run
while the PC is logged in with a restricted user account. My problem is
all
the quotes in the runas command!
When I inspect the properties of the Install Shield shortcut, I see this:
"C:\Program Files\Common Files\InstallShield\UpdateService\ISUSPM.exe"
-custom"C:\Documents and Settings\All Users\Application Data\Ford Motor
Company\IDS\flexids.ini"
You can see that InstallShield is run, with a custom switch. To complicate
matters, both paths have spaces, so they are enclosed in quotes.
Here's the script I have:
===============================================
Option explicit
dim oShell
set oShell= Wscript.CreateObject("WScript.Shell")
'EXE TO RUN
' "C:\Program Files\Common Files\InstallShield\UpdateService\ISUSPM.exe"
-custom"C:\Documents and Settings\All Users\Application Data\Ford Motor
Company\IDS\flexids.ini"
dim strCmd
strCmd="runas /user:Administrator " & "C:\Program Files\Common
Files\InstallShield\UpdateService\ISUSPM.exe" -custom"C:\Documents and
Settings\All Users\Application Data\Motor Company\IDS\flexids.ini"
'This command echos the the strCmd to the screen. It is commented out for
production use
Wscript.Echo strCmd
oShell.Run strCmd
WScript.Sleep 1000
'Replace the string yourpassword~ below with
'the password used on your system. Include tilde
oShell.Sendkeys "password~"
Wscript.Quit
=============================================
I can't seem to figure out the proper way to handle all the quotes on the
runas command. I've tried using chr(34) in different configurations with
no
luck. Those 'internal' quotes are killing me.
Any help would be GREATLY appreciated!
Thanks,
Jeff
Quotes embedded in a quoted string should be doubled. Perhaps you want
similar to below (watch line wrapping, this is 3 lines):
strCmd = "runas /user:Administrator " _
& """C:\Program Files\Common
Files\InstallShield\UpdateService\ISUSPM.exe""" _
& " -custom ""C:\Documents and Settings\All Users\Application Data\Motor
Company\IDS\flexids.ini"""
I broke the string up into 3 concatenated strings. I assume there should be
a space after "-custom", but you didn't have one there. If you echo the
above string at a command prompt the command should look correct.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
- References:
- runas: need help with those quotes
- From: jrsmoots
- Re: runas: need help with those quotes
- From: Richard Mueller [MVP]
- runas: need help with those quotes
- Prev by Date: Re: runas: need help with those quotes
- Next by Date: Re: vbscript to copy files from netlog to local profile folder
- Previous by thread: Re: runas: need help with those quotes
- Index(es):
Relevant Pages
|