Jump to content
Sign in to follow this  
Jewtus

running command copy with @scriptdir

Recommended Posts

Jewtus

I'm trying to execute a copy statement from in my script (basically I'm using it to concatenate all the text files in a folder)

When I give the explicit path it works, but when I try to use @scriptdir it doesn't

RunWait('"' & @ComSpec & '" /c copy C:\Automation\AutoIt\db\log\*.txt C:\Automation\AutoIt\db\log\outfile.csv', '', @SW_HIDE)

When I try to use

RunWait('"' & @ComSpec & '" /c copy '&@ScriptDir"\db\log\*.txt "&@ScriptDir"\db\log\merged.csv"&', '', @SW_HIDE)

it errors. 

 

I've been trying to figure out a simple way of doing this and I even tried this:

$CMDLINE[copy @ScriptDir&"\db\log\*.txt" @ScriptDir&"\db\log\output.csv"]

but I seem to be missing something. 

Any suggestions?

Share this post


Link to post
Share on other sites
Chimp

some ampersand "&" are missing and some " exceed

 try this:

RunWait(@ComSpec & ' /c copy ' & @ScriptDir & '\db\log\*.txt ' & @ScriptDir & '\db\log\merged.csv', '', @SW_HIDE)

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
Jewtus

Perfect. Thanks

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.