Sign in to follow this  
Followers 0
Erhnam

Using Run and variables

3 posts in this topic

#1 ·  Posted (edited)

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



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

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