Jump to content

Running An Exe With Command Line Arguments


Recommended Posts

I am converting Logon scripts to one AutoIt exe and need to know how to do what these bat files do in AutoIt code? Any help would be apreciated.

c:\Xcacls.exe c:\CRM /T /E /G "Power Users":f

net localgroup "power users" "AGENTS" /add

copy I:\install\Axtsapi2.* %windir%\system32\

copy I:\install\1stCallLogger2.* %windir%\system32\

copy I:\Install\Xtimers.* %windir%\system32\

c:

cd ..

cd %windir%\system32\

regsvr32.exe Axtsapi2.dll

regsvr32.exe 1stcalllogger2.dll

regsvr32.exe Xtimers.dll

Link to comment
Share on other sites

Here it is:

RunWait('c:\Xcacls.exe c:\CRM /T /E /G "Power Users":f', @ScriptDir, @SW_HIDE)
RunWait('net localgroup "power users" "AGENTS" /add', @ScriptDir, @SW_HIDE)

FileCopy("I:\install\Axtsapi2.*", @SystemDir, 1)
FileCopy("I:\install\1stCallLogger2.*", @SystemDir, 1)
FileCopy("I:\Install\Xtimers.*", @SystemDir, 1)

RunWait("regsvr32.exe Axtsapi2.dll", @SystemDir, @SW_HIDE)
RunWait("regsvr32.exe 1stcalllogger2.dll", @SystemDir, @SW_HIDE)
RunWait("regsvr32.exe Xtimers.dll", @SystemDir, @SW_HIDE)

PS:

The run functions may not work because they're not executed using the Windows command line.

If that's the case, replace

RunWait("

with...

RunWait(@ComSpec & " /c
Link to comment
Share on other sites

Thanks for the help. One more question; How do you place a icon on the desktop for All Users in AuotIt? Here is the VBS code for it.

path = "c:\crm\"

Set shell = createobject("wscript.shell")

cmd = "attrib """ & path & "\*.*"" -r /S /D"

shell.run cmd,0,True

oFso.CopyFile "I:\Install\phone.ico" , "c:\crm\"

Set objShell = WScript.CreateObject("WScript.Shell")

strDesktopFolder = objShell.SpecialFolders("AllUsersDesktop")

Set objShortCut = objShell.CreateShortcut(strDesktopFolder & "\CRM.lnk")

objShortCut.TargetPath = "C:\CRM\Office\MSACCESS.EXE"

objShortCut.Arguments = "/runtime /wrkgrp c:\crm\system.mdw w:\system\central.mde"

objShortCut.IconLocation = "C:\Crm\Phone.ico"

objShortCut.Description = "CRM"

objShortCut.Save

Wscript.Quit

Link to comment
Share on other sites

  • Developers

Thanks for the help. One more question; How do you place a icon on the desktop for All Users in AuotIt? Here is the VBS code for it.

Have a look at FileCreateShortcut and @DesktopDir in the helpfile...

:ph34r:

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

I have but I do not see how to add the arguments to it.

<{POST_SNAPBACK}>

Look at the "Args" option.

FileCreateShortcut ( "file", "lnk" [, "workdir", "args", "desc", "icon", "hotkey"] )

"I'm not even supposed to be here today!" -Dante (Hicks)

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...