Jump to content
Sign in to follow this  
Erhnam

Using Run and variables

Recommended Posts

Erhnam

I want use variables within my Run command. Is this possible. The MsgBox seems to pop-up without any problems. Now the next step to create a directory using the variable. How can I do this?

$var = String("C:\Test")

MsgBox(4096, "Path variable is:", $var)

Run("cmd /c mkdir" & $var, "", @SW_MAXIMIZE)

Edited by Erhnam

Share this post


Link to post
Share on other sites
sandyd

Hi Erham,

You can use the DirCreate function, search the help for it.

In your example, you cannot just run a dos command, lookup Run in the help and notice the part that mentions @COMSPEC


----[ SandyD ]---

Share this post


Link to post
Share on other sites
Danny35d

I will use sandyd suggestion DirCreate() function, but referring to Run() function you didn't leave a space between mkdir and quotes. Another thing I will @ComSpec macro instead of cmd.

Run(@ComSpec & " /c mkdir " & $var, "", @SW_MAXIMIZE)

Without the space between mkdir and quotes run command look like mkdirC:\Test instead of mkdir C:\Test


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.