Jump to content

ComSpec


Recommended Posts

I have looked in the archives but I don't find anything that I can understand to help determine what is wrong with my code.

$dest1 = "C:\scripting\AutoIT scripts\PT OT ST Stats\";for use when testing locally
.
.
$ThisMonth = @MON
$year = @YEAR
If $ThisMonth = 1 Then
   $LastMonth = 12
   $Year = @YEAR - 1
Else
   $LastMonth = @MON - 1
   If $LastMonth < 10 Then
      $LastMonth = "0" & $LastMonth
   EndIf
EndIf
.
.
RunWait(@ComSpec & " /c " & 'copy ' & $dest1 & "rehabvisits" & $year & $lastmonth & "*.txt " & $dest1 & "rehabvisits" & $year & $lastmonth & ".all", "", @SW_MINIMIZE);executes the DOS copy command and concatenates all the previous month's files together into one.

All I want to do is concatenate a bunch of monthly files into one big file. Files in folder are named as follows;

rehabvisits20070401.txt

rehabvisits20070402.txt

rehabvisits20070403.txt

.

.

rehabvisits20070430.txt

When I remove the $dest1 variable, it works just fine so that leads me to think it has something to do with the spaces in the folder name. I have tried multiple iterations of quotes (both single and double) to no avail.

Link to comment
Share on other sites

Try:

RunWait(@ComSpec & ' /c copy "' & $dest1 & 'rehabvisits' & $year & $lastmonth & '*.txt" "' & $dest1 & 'rehabvisits' & $year & $lastmonth & '.all"', "", @SW_MINIMIZE)

Single quotes for AutoIt are enclosing double quotes for the CMD shell.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...