Sign in to follow this  
Followers 0
igorm

Help needed with runing command in command prompt.

6 posts in this topic

Hi

I need a little help.

I need to execute the following in command prompt:

cd C:\folder
FOR %%f IN (*.msp) DO msiexec /p %%f /a C:\folder_one\pro11.msi SHORTFILENAMES=TRUE /qb

I know that I can use Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE). But I need to execute both command's in same Command Prompt window.

Any help with this?

Thanks in advance for help.

Cheers :)

Share this post


Link to post
Share on other sites



write a cmd file in %temp% and execute that file with RunWait(@comspec /c " & $filename). Something like that.

Share this post


Link to post
Share on other sites

Hi

I need a little help.

I need to execute the following in command prompt:

cd C:\folder
FOR %%f IN (*.msp) DO msiexec /p %%f /a C:\folder_one\pro11.msi SHORTFILENAMES=TRUE /qb

I know that I can use Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE). But I need to execute both command's in same Command Prompt window.

Any help with this?

Thanks in advance for help.

Cheers :)

===============

I'm kinda new to participating in forums, but I'll see what I can do. Please help me understand better what you are trying to accomplish. What I see from looking at your code first off is that you do not need to use the command prompt to execute an MSI. Also, you need a RUN or RUNWAIT before the MSIEXEC. Remember, you are not launching the PRO11.MSI, you are launching MSIEXEC which in turn will do with the PRO11.MSI what it needs to.

I would assume you can run it using a similar command-line as I used for installing the Acrobat Reader 8.1:

RunWait('MSIEXEC.EXE /i "' & @ScriptDir & '\Acroread.msi" /qb')

I assume PRO11.MSI is Microsoft Office Professional 2003. It looks like your are trying to slipstream the patches into the PRO11.MSI. You should be able to form your full command-line to include the elements you need in the same line.

Gotchas: One of the issues I have run accross that doesn't seem obvious at times, is the fact that you might have spaces where you really don't want them. As you may know, any paths with spaces need to be surrounded by double quotes (").

TIP: As regular programming practice, I always use single quotes in AutoIT for strings, so that when I need to do a command-line statement, I can include the double quotes as a standard. This technique along with the use of @ macros (or variables) make your scripts portable, and functional under any folder or network UNC address.

Troubleshooting Tip: When in doubt, take your command-line parameter and stick it into an MsgBox to display the command that the script would need to execute. using my example above, I would do this:

Msgbox(0,'','MSIEXEC.EXE /i "' & @ScriptDir & '\Acroread.msi" /qb')

This line will display a message box showing you exactly what would be executed if you had used a RUN or RUNWAIT instead. This will reveal if you have spaces where there shouldn't be etc.

I hope this helps.

Share this post


Link to post
Share on other sites

write a cmd file in %temp% and execute that file with RunWait(@comspec /c " & $filename). Something like that.

That was my first thought, but the problem is path which will cmd use. In my example C:\folder_one needs to be replaced with user input. That's why I gave up from this idea, but maybe you know some way to replace it.

@Davegbuf

I'll try to figure out something from your post.

Share this post


Link to post
Share on other sites

As an example

In Scite, Type "selfdelete" (no quotes)

Then press the spacebar, you will see a script that writes a cmd file with user input

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Guys, thanks for help, but I manage to solve my problem using _FileWriteToLine. I wrote the cmd file with necessary commands, and then I use _FileWriteToLine to replace the path.

Cheers :)

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  
Followers 0