Jump to content
Sign in to follow this  
secun

Question about Run with quotes

Recommended Posts

Can someone tell me why this line of code won't work?

Run ("c:\msderela\setup SAPWD=""MyFavoritePassord"" TARGETDIR=C:\MSDE

SECURITYMODE=SQL")

I've also tried:

Run ('c:\msderela\setup SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE

SECURITYMODE=SQL')

Thanks!!

Share this post


Link to post
Share on other sites

Try:

Run ("c:\msderela\setup SAPWD=" & Chr(34) & "MyFavoritePassword" & Chr(34) & " TARGETDIR=C:\MSDE SECURITYMODE=SQL")

Share this post


Link to post
Share on other sites

Can someone tell me why this line of code won't work?

Run ("c:\msderela\setup SAPWD=""MyFavoritePassord"" TARGETDIR=C:\MSDE

SECURITYMODE=SQL")

I've also tried:

Run ('c:\msderela\setup SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE

SECURITYMODE=SQL')

Thanks!!

<{POST_SNAPBACK}>

Both of these generate the command:
c:\msderela\setup SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE SECURITYMODE=SQL

Does this work withoug error from a DOS command prompt?


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Both of these generate the command:

c:\msderela\setup SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE SECURITYMODE=SQL

Does this work withoug error from a DOS command prompt?

<{POST_SNAPBACK}>

Yes.

Share this post


Link to post
Share on other sites

Try:

Run ("c:\msderela\setup SAPWD=" & Chr(34) & "MyFavoritePassword" & Chr(34) & " TARGETDIR=C:\MSDE SECURITYMODE=SQL")

<{POST_SNAPBACK}>

I tried this. The response was

Error: Unable to execute the internal program.

Share this post


Link to post
Share on other sites

Run(@ComSpec & " /C c:\msderela\setup SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE SECURITYMODE=SQL ")

im not sure if i have the correct """""""" :( didnt test it mayb add some ' ' or ""

Share this post


Link to post
Share on other sites

Both of these generate the command:

c:\msderela\setup SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE SECURITYMODE=SQL

Does this work withoug error from a DOS command prompt?

<{POST_SNAPBACK}>

The following script may help you debug. It shows parameters as they are consumed by an autoit script... your program may in fact handle them differently, but not likely.

;ShowParams.au3
$str = "Number of Params: " & $CmdLine[0] & @CR
For $i = 1 to $CmdLine[0]
    $str = $str & "Param" & $i & " " & $CmdLine[$i] & @CR
Next
MsgBox(0,"Param Test", $str)

Assuming you put this script in c:\, you run it like this:

autoit3 c:\ShowParams.au3 SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE SECURITYMODE=SQL

I think you'll see that you most likely need another set of quotes around the password string... like this:

Run('c:\msderela\setup SAPWD=""MyFavoritePassord"" TARGETDIR=C:\MSDE SECURITYMODE=SQL')

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Assuming you put this script in c:\, you run it like this:

autoit3 c:\ShowParams.au3 SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE SECURITYMODE=SQL

I think you'll see that you most likely need another set of quotes around the password string... like this:

Run('c:\msderela\setup SAPWD=""MyFavoritePassord"" TARGETDIR=C:\MSDE SECURITYMODE=SQL')

Dale

This didn't work either. It gave the same result.

Are we missing something simple? Is there a way in AutoIT to break it down into sections like:

Run ("notepad.exe", "c:\mytestfile.txt")

Thanks again for everyone's help.

Share this post


Link to post
Share on other sites

Run(@ComSpec & " /C c:\msderela\setup SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE SECURITYMODE=SQL ")

im not sure if i have the correct """""""" :( didnt test it mayb add some ' '  or ""

<{POST_SNAPBACK}>

Wouldn't this display my password when it runs? That kind of defeats of the purpose. :(

Share this post


Link to post
Share on other sites

try

Run(@ComSpec & ' /C c:\msderela\setup SAPWD="MyFavoritePassord" TARGETDIR=C:\MSDE SECURITYMODE=SQL ',"",@SW_hide)

the comspec only opens for a sec or less to launch the other program. You can minimise it, or hide it completely. Not perfectly safe, but nothing really is.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

So what error are you getting exactly? Did you try playing with the ShowParams.au3 script I gave you to see if it helped with your debugging?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

So what error are you getting exactly?  Did you try playing with the ShowParams.au3 script I gave you to see if it helped with your debugging?

Dale

<{POST_SNAPBACK}>

------------------------------------------

I just tried it and it was enlightening.

Number of params: 4

Param1 c:\msderela\setup

Param2 SAPWD="MyFavoritePassord"

Param3 TARGETDIR=c:\msde

Param4 SECURITYMODE=SQL

Shouldn't 2,3, and 4 all be one parameter? Isn't that part of the problem?

Hmmm... What if I enclose 2-4 in quotes...

It's late here. I'll try it tomorrow.

Share this post


Link to post
Share on other sites

Well... I feel really silly.

The answer was to fully qualify the executable name.

"c:\msderela\setup.exe SAPWD=""WAFSFieldEstimator"" TARGETDIR=C:\MSDE SECURITYMODE=SQL"

Thanks again for everyone's help!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...