string - AutoIT, Using Variable in DirCopy Paths -


i attempting use local variable in dircopy command when insert $variable c:\users\store$variable\desktop path attempts read path literally instead of using $variable.

the objective create prompt store number , insert number bunch of dircopy lines ensure profiles contain number. issue profiles 1 word, ex. store123, reciever123.

this put far can't take variable in way.

local $store = inputbox ( "store number" , "what store this?" ) dircopy ( "\\192.168.1.3\c$\documents , settings\store$store\desktop" , "c:\users\store$store\desktop" )  dircopy ( "\\192.168.1.3\c$\documents , settings\profile$store\desktop" , "c:\users\profile$store\desktop") 

is there formatting issue? or not possible in autoit?

method 1: concatenation

in order use variables inside strings, need concatenate them, using & operator:

$nvar = 42 $sstr = "hello, " & $nvar & "world!" ; $sstr hold: "hello, 42world!" 

method 2: expansion

however, there opt() flag expandvarstrings enables inline variable use:

opt("expandvarstrings", 1) ;0=don't expand, 1=do expand $nvar = 42 $sstr = "hello, $nvar$world!" ; $sstr contains: "hello, 42world!" 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -