Jump to content

Please help i need space between source and destination. Below script i am getting error parameter is incorrect - (Moved)


Recommended Posts

  • Moderators
Posted

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

  Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Expand  

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)
;
        Case $msg = $Button_2
            OpenFile1()
            Func OpenFile1()
                $Path = @DesktopDir & "\varma\Backup.txt"
                ShellExecute($Path)
            EndFunc   ;==>OpenFile1

        Case $msg = $Button_3

??

 

EDIT:
Func OpenFile1()
and
Func OpenFile2()

Should not be declared inside of another function.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Please put Robocopy.exe in script directory.

attached backuplog.txt file for error reference. Please help me out to resolve this issue.

C:\Users\V13743\Desktop\C:\Backup\HP4E302407\V13743\Desktop\*.*
        *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /NP /XO /XJ /R:2 /W:2 C:\Users\V13743\Desktop\Backup_Log_31_08_2020_12-41-06.logC:\Users\V13743\Desktop\Backup_Log_31_08_2020_12-41-06.logThe parameter is incorrect.

 

 

RoboBackup&Restore.txtFetching info... Backuplog.txtFetching info...

Posted

I am new to AutoIT script and i have less knowledge on scripting somehow developed attached code. Could you please modify my existing code. 

I am getting parameter is incorrect while executing. Some machines it's working some machines it's getting parameter is incorrect. Log shown below.

C:\Users\V13743\Desktop\C:\Backup\HP4E302407\V13743\Desktop\*.*
        *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /NP /XO /XJ /R:2 /W:2 C:\Users\V13743\Desktop\Backup_Log_31_08_2020_12-41-06.logC:\Users\V13743\Desktop\Backup_Log_31_08_2020_12-41-06.logThe parameter is incorrect.

Posted

tell me if i am wrong i think as below log shows there is not gap between Desktop\C:\Backup is this is the issue for parameter is incorrect error?

C:\Users\V13743\Desktop\C:\Backup\HP4E302407\V13743\Desktop\*.*
        *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /NP /XO /XJ /R:2 /W:2 C:\Users\V13743\Desktop\Backup_Log_31_08_2020_12-41-06.logC:\Users\V13743\Desktop\Backup_Log_31_08_2020_12-41-06.logThe parameter is incorrect.

Posted
.....
.....
            ; RunWait('robocopy "' & $var2 & "\" & @UserName & '\Desktop"' & ' "' & @UserProfileDir & '\Desktop" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log:Restore.txt', "", @SW_SHOWNORMAL)
            _Run_Robocopy( _
                    $var2 & '\' & @UserName & '\Desktop\', _
                    @UserProfileDir & '\Desktop', _
                    Default)
.....
.....
.....
.....
.....
.....
.....
Func _Run_Robocopy($source, $destination, $parameters = Default)
    if parameters = Default then $parameters = '*.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restore.txt'
    RunWait('robocopy "' & $source  & '" "' & $destination & '" ' & $parameters, '', @SW_SHOWNORMAL)
EndFunc

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Thanks mLipok...Restore it's working fine. But i given backuplog i am having issues with backup.

I think there is no spaces between source and destination that's why it's getting parameter is incorrect. I am trying to put space. Please anyhow help me to put space in my backup script below.

RunWait('robocopy "' & @UserProfileDir & '\Desktop"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Desktop" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log:Backup.txt', "", @SW_SHOWNORMAL)

 

Log

C:\Users\V13743\Desktop\C:\Backup\HP4E302407\V13743\Desktop\*.*
        *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /NP /XO /XJ /R:2 /W:2 C:\Users\V13743\Desktop\Backup_Log_31_08_2020_12-41-06.logC:\Users\V13743\Desktop\Backup_Log_31_08_2020_12-41-06.logThe parameter is incorrect.

Backup&Restore_v1.0.txtFetching info...

Posted (edited)

There is a space in that line.

Here use this function to debug the text:

$var1 = EnvGet("systemdrive")

RunWaitCW('robocopy "' & @UserProfileDir & '\Desktop"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Desktop" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log:Backup.txt', "", @SW_SHOWNORMAL)

Func RunWaitCW($txt,$a,$b)
    ConsoleWrite($txt & @CRLF)
EndFunc   ;==>RunWaitCW

(you have to rename all RunWAit calls as RunWaitCW(), and comment out the filedelete lines.

Edited by Dan_555

Some of my script sourcecode

Posted

Thanks Dan_555 but it's not working. I given as below is it correct?

While 1
    $msg = GUIGetMsg()
    Select
      Case $msg = $Button_1
        RunWaitCW('robocopy "' & @UserProfileDir & '\Desktop"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Desktop" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log:Backup.txt', "", @SW_SHOWNORMAL)
        Func RunWaitCW($txt,$a,$b)
    ConsoleWrite($txt & @CRLF)
EndFunc   ;==>RunWaitCW
        MsgBox(0, "Job Status", "Backup Done ...", 2)
        ;FileDelete($file)
        

Posted
  On 8/31/2020 at 1:56 PM, BhanuSrikanth said:

tell me if i am wrong i think as below log shows there is not gap between Desktop\C:\Backup is this is the issue for parameter is incorrect error?

Expand  

I agree. However, I didn't run into that issue when running your script. So either we aren't running the same version or there is something

Have you downloaded Scite like I recommended previously? If so, show use the results from the output panel.

P.S. You need to stop begging for help and start showing some effort on your part. Continually reposting the same thing and expecting someone to fix your code gets old real fast. :naughty:

Posted (edited)

And when you copy and paste things:

The lines in between (including) Func and End Func should be pasted at the end of the code. 

The RunWaitCW does only write a text in the Scite's console window. 

 

This is the cleaned up version, but it is only for testing:

;==================================================
;==================================================
#include <GDIPlus.au3>
#include <MsgBoxConstants.au3>
$prompt = MsgBox(4129, "Warning", "Close all your applications before using this tool")
If $prompt = "2" Then Exit
Dim $hGUI, $hImage, $hGraphic, $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $font, $var1, $var2, $file
$var1 = EnvGet("systemdrive") ;
;==================================================
;If Not FileExists(@SystemDir & '\robocopy.exe') Then FileInstall('Robocopy.exe', @SystemDir & '\Robocopy.exe', 0)
#include <GuiConstants.au3>

$hGUI = GUICreate("Backup&Restore_v1.0", 320, 300, (@DesktopWidth - 320) / 2, (@DesktopHeight - 300) / 2, $WS_SIZEBOX + $WS_SYSMENU)
GUISetState()
$font = "Arial Bold"
GUISetFont(12, 600, "", $font)
GUISetBkColor(0xE0FFFF)  ;

; Load PNG image
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\test.png")

; Draw PNG image
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 20, 20)

$Button_1 = GUICtrlCreateButton("Backup", 180, 20, 90, 40)
$Button_2 = GUICtrlCreateButton("Backuplog", 180, 70, 90, 40)
$Button_3 = GUICtrlCreateButton("Restore", 180, 120, 90, 40)
$Button_4 = GUICtrlCreateButton("Restorelog", 180, 170, 90, 40)
$Button_5 = GUICtrlCreateButton("Quit", 80, 210, 90, 40)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Button_1
            RunWaitCW('robocopy "' & @UserProfileDir & '\Desktop"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Desktop" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Citrix"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Citrix" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Contacts"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Contacts" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Documents"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Documents" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\3D Objects"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\3D Objects" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Downloads"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Downloads" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT //MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Favorites"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Favorites" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Links"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Links" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Music"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Music" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\OneDrive"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\OneDrive" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Pictures"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Pictures" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Saved Games"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Saved Games" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Searches"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Searches" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & @UserProfileDir & '\Videos"' & ' "' & $var1 & "\" & "Backup" & "\" & @ComputerName & "\" & @UserName & '\Videos" *.* /NDL /TEE /S /E /DCOPY:DA /COPY:DAT /MIR /NP /XO /XJ /R:2 /W:2 /log+:Backuplog.txt', "", @SW_SHOWNORMAL)
            MsgBox(0, "Job Status", "Backup Done ...", 2)
            ;FileDelete($file)

        Case $msg = $Button_2
            OpenFile1()

        Case $msg = $Button_3
            $var2 = EnvGet("systemdrive") ;
            $var2 = FileSelectFolder('Select a target path.', ' ', 2)
            If @error = 1 Then
                MsgBox(0, "User Cancelled", "User cancelled, Exiting Program", 3)
                Exit
            EndIf
            ;FileClose($file)
            ;FileDelete($file)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Desktop"' & ' "' & @UserProfileDir & '\Desktop" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2 /log:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Citrix"' & ' "' & @UserProfileDir & '\Citrix" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Contacts"' & ' "' & @UserProfileDir & '\Contacts" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Documents"' & ' "' & @UserProfileDir & '\Documents" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\3D Objects"' & ' "' & @UserProfileDir & '\3D Objects" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Downloads"' & ' "' & @UserProfileDir & '\Downloads" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Links"' & ' "' & @UserProfileDir & '\Links" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Music"' & ' "' & @UserProfileDir & '\Music" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\OneDrive"' & ' "' & @UserProfileDir & '\OneDrive" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Pictures"' & ' "' & @UserProfileDir & '\Pictures" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Saved Games"' & ' "' & @UserProfileDir & '\Saved Games" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Searches"' & ' "' & @UserProfileDir & '\Searches" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Videos"' & ' "' & @UserProfileDir & '\Videos" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            RunWaitCW('robocopy "' & $var2 & "\" & @UserName & '\Favorites"' & ' "' & @UserProfileDir & '\Favorites" *.* /NDL /TEE /S /E /PURGE /DCOPY:DA /COPY:DAT /NP /XX /XO /XJ /R:2 /W:2  /log+:Restorelog.txt', "", @SW_SHOWNORMAL)
            MsgBox(0, "Job Status", "Restore Done ...", 2)
            ;FileDelete($file)


        Case $msg = $Button_4


        Case $msg = $Button_5
            Exit
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
            ;;;
    EndSelect
WEnd
Exit

; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()

OpenFile2()
Func OpenFile2()
    $Path = @DesktopDir & "\varma\Restorelog.txt"
    ;ShellExecute($Path)
EndFunc   ;==>OpenFile2

Func OpenFile1()
    $Path = @DesktopDir & "\varma\Backuplog.txt"
    ;ShellExecute($Path)
EndFunc   ;==>OpenFile1

Func RunWaitCW($txt, $a, $b)
    ConsoleWrite($txt & @CRLF)
EndFunc   ;==>RunWaitCW

It is basically only for debugging.

You have FileDelete($file) in this script, but there is nowhere a referrence to the $file.
The FileClose is meaningless in this case, too, because there is no file being opened.

Edited by Dan_555

Some of my script sourcecode

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
  • Recently Browsing   0 members

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