Jump to content

running exe with parameters


Recommended Posts

was looking at internet and found this to run via command line and wondered how to do it via autoit

C:pathbin>call mdrv.exe -usr "c:testtestFotMdrv.usr"

tried doing this and its come up with syntax errors (see attachment)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_Outfile_type=a3x
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Run (C:Program Files (x86)HPUnified Functional Testingbinmdrv.exe -usr , "C:pwcPWC-QTPPWC-QTP.usr")

post-47107-0-49969900-1410306517_thumb.j

Link to comment
Share on other sites

  • Moderators

Try something like this:

$sPath = "C:\Program Files (x86)\HP\Unified Functional Testing\bin\mdrv.exe"
ShellExecute($sPath, ' -usr , "C:\pwc\PWC-QTP\PWC-QTP.usr"')
 If @error Then ConsoleWrite("Run failed with error: " & @error & @CRLF)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

#include <MsgBoxConstants.au3>

$Path = "C:\path\bin\"
$Exe = "call mdrv.exe"
$Switch1 = "-usr"
$Switch2 = '"' & "" & 'c:\test\testForMdv.usr' & '"'

MsgBox(0,"",$Path & $Exe & " " & $Switch1 & " " & $Switch2)

Here's a dirtier way of doing it.

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

  • Moderators

So that tells you that the first half of the ShellExecute (the path to the file) is correct. You have an error in the command line parameters. Is there supposed to be a space between -user and the comma? Can you verify the 'C:pwcpwc-qtppwc-qtp.usr' file exists?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

this is the code now

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_type=a3x
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$sPath = "C:Program Files (x86)HPUnified Functional Testingbinmdrv.exe"
ShellExecute($sPath, ' -usr "C:pwcPWC-QTPPWC-QTP.usr"')
 If @error Then ConsoleWrite("Run failed with error: " & @error & @CRLF)
 
seems to run it but nothing is started
>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:UsersJoe LoyzagaDesktopRun UFT.au3" /UserParams    
+>09:35:57 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0   Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409)
+>         SciTEDir => C:Program Files (x86)AutoIt3SciTE   UserDir => C:UsersJoe LoyzagaAppDataLocalAutoIt v3SciTEAutoIt3Wrapper   SCITE_USERHOME => C:UsersJoe LoyzagaAppDataLocalAutoIt v3SciTE 
>Running AU3Check (3.3.12.0)  from:C:Program Files (x86)AutoIt3  input:C:UsersJoe LoyzagaDesktopRun UFT.au3
+>09:36:02 AU3Check ended.rc:0
>Running:(3.3.12.0):C:Program Files (x86)AutoIt3autoit3.exe "C:UsersJoe LoyzagaDesktopRun UFT.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>09:36:03 AutoIt3.exe ended.rc:0
+>09:36:03 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 6.028
Link to comment
Share on other sites

  • Developers

Try

Shellexecute('C:Program Files (x86)HPUnified Functional Testingbinmdrv.exe','-usr "c:pwcPWC-QTPPWC-QTP.usr"','C:Program Files (x86)HPUnified Functional Testingbin')

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...