Sign in to follow this  
Followers 0
FGR

A question using RunWait with parameters

10 posts in this topic

Hi!

I'm trying to do this under Windows XP:

RunWait(@ComSpec & ' /c'& "%PROGRAMFILES%\WinRAR\rar.exe" a file_comp.rar *.au3') ; (I also tried Run()).

but it doesn't work, althought the command works fine in the line command.

The idea is to pass more parameters like the namefile as %USERNAME% and the Folder to compress, but with the first trying i can't advance.

Any idea?

Thanks for all.

FGR.

Share this post


Link to post
Share on other sites



RunWait(@ComSpec & ' /c'& '"%PROGRAMFILES%\WinRAR\rar.exe" a file_comp.rar *.au3')

Share this post


Link to post
Share on other sites

RunWait(@ComSpec & ' /c'& '"%PROGRAMFILES%\WinRAR\rar.exe" a file_comp.rar *.au3')

Thanks, and sorry with the simple quote (a writing error). It doesn't works either, a command windows appears and dissappears but the Rar file is not created.

Share this post


Link to post
Share on other sites

You can use Run( @ComSpec & "/k" ) for testing purposes. This will keep the window open.


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Try changing the /c to a /k and have it leave the window open, there might be something in the console that will help you trouble shoot what's going wrong. Also, add a space after the /c or the /k and before the " that might help as well.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

You can use Run( @ComSpec & "/k" ) for testing purposes. This will keep the window open.

Thanks for the help and that option.

The problem was the double quote. Now it works:

RunWait(@ComSpec & ' /k'& '""%ProgramFiles%\WinRAR\rar.exe"" a file_comp.rar *.au3')

Thank you again :unsure:

Share this post


Link to post
Share on other sites

Another question:

RunWait(@ComSpec & ' /c'& '""%ProgramFiles%\WinRAR\rar.exe"" a %USERNAME%.Rar *.au3',@SW_HIDE)

is @SW_HIDE correct to hide the command windows? It doesn't compress in this case.

Thanks for the help and that option.

The problem was the double quote. Now it works:

RunWait(@ComSpec & ' /k'& '""%ProgramFiles%\WinRAR\rar.exe"" a file_comp.rar *.au3')

Thank you again :unsure:

Share this post


Link to post
Share on other sites

@SW_HIDE will not work well in the working directory parameter of Run().

Try this

RunWait('"' & @ComSpec & '" /c "%ProgramFiles%\WinRAR\rar.exe" a %USERNAME%.Rar "*.au3"', "", @SW_HIDE)

Share this post


Link to post
Share on other sites

In this case, you're using the @SW_HIDE flag in the WorkingDir parameter which I'm sure is confusing things.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thank you to all. It's true. The Working Directory as optional is not working well. Now it works.

Thanks again.

The Post is closed :unsure:.

Thank you again.

In this case, you're using the @SW_HIDE flag in the WorkingDir parameter which I'm sure is confusing things.

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