在Run函数中将参数作为变量传递

时间:2019-10-22 06:26:27

标签: autoit

如标题所示,这是我的代码,但不起作用

; Get the parameter from open file dialog
GUICtrlSetData($locationtxt, FileOpenDialog("Select the program", '', "Supported files (*.exe;*.msi;*.reg;*.inf)|Executable Files (*.exe)|Microsoft Installer files (*.msi)|Registry files (*.reg)|Inf files (*.inf)", 3))

; store the value in a variable 
 $abc = GUICtrlRead($locationtxt)
 ; Run the program and pass the parameter value
            Run("ussf.exe "  & $abc  )

  ; If i do it this way, its working but i want the parameter value from the open dialog not fixed
  Run("ussf.exe C:\Users\project\ccsetup563.exe")

1 个答案:

答案 0 :(得分:0)

Run()的第二个参数是工作目录,而不是程序的参数。我认为您应该改用ShellExecute()或ShellExecuteWait()。