I am attempting to use a Local variable in a DirCopy command but when I insert the $Variable
into the C:\Users\store$Variable\Desktop
path it attempts to read the path literally instead of using the $Variable.
The objective is to create a prompt for the Store number and insert that number into a bunch of DirCopy lines to ensure we get the profiles that contain only that number. The issue is that the profiles are one word, ex. store123, reciever123.
This is what I put together so far but I can't get it to take the variable in this way.
Local $STORE = InputBox ( "Store Number" , "What Store is This?" )
DirCopy ( "\\192.168.1.3\C$\Documents and Settings\store$STORE\Desktop" , "C:\Users\Store$STORE\desktop" )
DirCopy ( "\\192.168.1.3\c$\Documents and Settings\Profile$STORE\Desktop" , "C:\Users\Profile$STORE\Desktop")
Is there a formatting issue? or is this not possible in AutoIT?
Method 1: Concatenation
In order to use Variables inside strings, you need to concatenate them, by using the
&
operator:Method 2: Expansion
However, there is a
Opt()
flagExpandVarStrings
that enables inline variable use: