Secure use of passwords in batch files?


Recommended Posts

One thing for starters, youre missing a comma after the robocopy options:

1=/mir /dcopy:T /copy:DATO /xd,"D:\Patrick\Downloads" "D:\Patrick\Desktop" /xa:h,D:\Patrick,\\DOWNSTAIRS\Patrick$

Then theres the options that appear in the wrong place /xa:h

1=/mir /dcopy:T /copy:DATO /xd,"D:\Patrick\Downloads" "D:\Patrick\Desktop" /xa:h,D:\Patrick,\\DOWNSTAIRS\Patrick$

It should be:

1=/mir /dcopy:T /copy:DATO /xd /xa:h,"D:\Patrick\Downloads" "D:\Patrick\Desktop" ,D:\Patrick,\\DOWNSTAIRS\Patrick$

The next issue is why there are 3 sets of folders listed:

"D:\Patrick\Downloads" "D:\Patrick\Desktop" ,D:\Patrick,\\DOWNSTAIRS\Patrick$

As noted before, and in the top of the script, the ini file format i used was:

job number = robocopy optionscommasource foldercommadestination folder

No, those options are correct. This works on the command line:

robocopy.exe "D:\Patrick" \\DOWNSTAIRS\Patrick$ /mir /dcopy:T /copy:DATO /xd "D:\Patrick\Downloads" "D:\Patrick\Desktop" /xa:h

/xd means exclude directory. I don't want Downloads or Desktop copied.

No, those options are correct. This works on the command line:

robocopy.exe "D:\Patrick" \\DOWNSTAIRS\Patrick$ /mir /dcopy:T /copy:DATO /xd/xa:h

/xd means exclude directory. I don't want Downloads or Desktop copied.

Then it needs to be:

1=/mir /dcopy:T /copy:DATO /xd "D:\Patrick\Downloads" "D:\Patrick\Desktop" /xa:h,D:\Patrick,\\DOWNSTAIRS\Patrick$

Look back at my post. That's exactly what I have.

too many late nights....

Was thinking about this issue while i was on the train to my country hideout on thursday, and its my fault it isnt running, forgot you were backing up to a network location, the destination folder check is only checking and parsing errors for physical drives

sometimes im as thick as ****

what you see in the log is destination drive as ]

because my physical drive check first strips the letter of the drive (i.e. z:\ becomes z) to check to see if its the truecrypt drive which we know will fail a drivestatus request...when you shove a network path in there it goes from \\ to \, and fails when it requests the status of drive \

You can try the following code in the mean time , as a quick patch job, Ill fix it when get home in a couple of days, currently having to type this on a mac in country nsw and i hate macs....this has to be the worst keyboard in history, i swear it was made by the same company that makes tic tacs.....no useful keys like end or home or page up/down, cut&paste doesnt work as on a civilized pc...if it was mine id have heaved it out of the window by now, its taken 3 times as long to type this message on this hopeless apple crap...even the sinclair had a better keyboard than this

I actually threatened to stop talking to my family i they bought this thing...why oh why didnt i follow through....

Of course fixing the network path for the destination means now that ive woken up i will fix it for the source folder check as well

As i may have mentioned im not exactly as im my prime mentally as i was a few years ago when i was doing this gear in my sleep

replace this section

                ;get the pure letter of the drive to check against the truecrypt mounted drive letter for the current job
                ;if its the same, we already know it exists and we skip the next part of the drive check. If we dont check
                ;for a match here and the truyecrypt drive letter makes it into the next check it will FAIL as even though
                ;the truecrypt drive is mounted, it will report UNKNOWN to DriveStatus. This "error" is because TrueCrypt is a container, not a real drive.
                $CheckDestinationFolder = StringLeft($CopyDestination, 1)
                ;check destination drive exists - no point always testing if folder exists as the job may be creating a folder
                ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                If $CheckDestinationFolder <> $TC_DriveLetter Then
                        $CheckDestinationFolder2 = DriveStatus(StringLeft($CopyDestination, 3))
                        Select
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "ERROR returned message - UKNOWN - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "READY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                Case "INVALID"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder &" exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                        EndSelect

                Else
                        ;write truecrypt container as destination to console/logfile
                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                EndIf

with:

                ;check for network path as destination
                $CheckNetworkDrive = StringLeft($CopyDestination, 2)
                If $CheckNetworkDrive = "\\" Then
                Else
                ;get the pure letter of the drive to check against the truecrypt mounted drive letter for the current job
                ;if its the same, we already know it exists and we skip the next part of the drive check. If we dont check
                ;for a match here and the truyecrypt drive letter makes it into the next check it will FAIL as even though
                ;the truecrypt drive is mounted, it will report UNKNOWN to DriveStatus. This "error" is because TrueCrypt is a container, not a real drive.
                $CheckDestinationFolder = StringLeft($CopyDestination, 1)
                ;check destination drive exists - no point always testing if folder exists as the job may be creating a folder
                ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                If $CheckDestinationFolder <> $TC_DriveLetter Then
                        $CheckDestinationFolder2 = DriveStatus(StringLeft($CopyDestination, 3))
                        Select
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "ERROR returned message - UKNOWN - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "READY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                Case "INVALID"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder &" exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                        EndSelect

                Else
                        ;write truecrypt container as destination to console/logfile
                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                EndIf
                EndIf

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....MOUNTED

Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....
Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....SUCCESSFUL

Processing jobs....

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DATO /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Checking source folder:  "D:\Temp" exists....
Job number:  1  Checking source folder:  "D:\Temp" exists....SUCCESS
Job number:  1  Checking destination drive:  H exists and is accessible....
Job number:  1  Checking destination drive:  H exists and is accessible....FAILED: UNKNOWN
Drive may be unformatted (RAW).

1  total jobs submitted for  processing
0  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....FAILED
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....MOUNTED

Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....
Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....SUCCESSFUL

Processing jobs....

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DATO /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Checking source folder:  "D:\Temp" exists....
Job number:  1  Checking source folder:  "D:\Temp" exists....SUCCESS
Job number:  1  Checking destination drive:  H exists and is accessible....
Job number:  1  Checking destination drive:  H exists and is accessible....FAILED: UNKNOWN
Drive may be unformatted (RAW).

1  total jobs submitted for  processing
0  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....FAILED
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED

Back home again, on a windows machine

Okay, fair cop, i will always admit when ive made a mistake

In this case you got the above error because i used Select/EndSelect when i should have used Switch/EndSwitch in the drive status check

And i also doubled up: Case "UNKNOWN" instead of "NOTREADY" ...fixed

I can confirm that both hard drive and network destinations work with the corrections

I will add checking for a network source folder and then post the complete code later tonight

existing code

                ;check for network path as destination
                $CheckNetworkDrive = StringLeft($CopyDestination, 2)
                If $CheckNetworkDrive = "\\" Then
                Else
                ;get the pure letter of the drive to check against the truecrypt mounted drive letter for the current job
                ;if its the same, we already know it exists and we skip the next part of the drive check. If we dont check
                ;for a match here and the truyecrypt drive letter makes it into the next check it will FAIL as even though
                ;the truecrypt drive is mounted, it will report UNKNOWN to DriveStatus. This "error" is because TrueCrypt is a container, not a real drive.
                $CheckDestinationFolder = StringLeft($CopyDestination, 1)
                ;check destination drive exists - no point always testing if folder exists as the job may be creating a folder
                ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                If $CheckDestinationFolder <> $TC_DriveLetter Then
                        $CheckDestinationFolder2 = DriveStatus(StringLeft($CopyDestination, 3))
                        Select
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "ERROR returned message - UKNOWN - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "READY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                Case "INVALID"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder &" exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UKNOWN" & _
                                        @CRLF & "ERROR returned message - INVALID - Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                        EndSelect

                Else
                        ;write truecrypt container as destination to console/logfile
                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                EndIf
                EndIf

corrected:

                ;check for network path as destination
                $CheckNetworkDrive = StringLeft($CopyDestination, 2)
                If $CheckNetworkDrive = "\\" Then
                Else
                ;get the pure letter of the drive to check against the truecrypt mounted drive letter for the current job
                ;if its the same, we already know it exists and we skip the next part of the drive check. If we dont check
                ;for a match here and the truyecrypt drive letter makes it into the next check it will FAIL as even though
                ;the truecrypt drive is mounted, it will report UNKNOWN to DriveStatus. This "error" is because TrueCrypt is a container, not a real drive.
                $CheckDestinationFolder = StringLeft($CopyDestination, 1)
                ;check destination drive exists - no point always testing if folder exists as the job may be creating a folder
                ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....")
                If $CheckDestinationFolder <> $TC_DriveLetter Then
                        $CheckDestinationFolder2 = DriveStatus(StringLeft($CopyDestination, 3))
                        Switch $CheckDestinationFolder2
                                Case "UNKNOWN"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "ERROR returned message - UKNOWN - Drive may be unformatted (RAW).")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: UNKNOWN" & _
                                        @CRLF & "Drive may be unformatted (RAW).")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "READY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY")
                                Case "NOTREADY"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: NOTREADY" & _
                                        @CRLF & "ERROR returned message - NOTREADY - Typical of floppy and CD drives that do not contain media.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: NOTREADY" & _
                                        @CRLF & "ERROR returned message - NOTREADY - Typical of floppy and CD drives that do not contain media.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop
                                Case "INVALID"
                                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder &" exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....FAILED: INVALID" & _
                                        @CRLF & "ERROR returned message - INVALID - May indicate the drive letter does not exist or that a mapped network drive is inaccessible.")
                                        ;decrease the amount of successful jobs by 1
                                        $NumberOfJobs -= 1
                                        ;skip to next job
                                        ContinueLoop

                        EndSwitch

                Else
                        ;write truecrypt container as destination to console/logfile
                        ConsoleWrite(@CRLF & "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                        FileWriteLine($Log, "Job number:  " & $i &  "  Checking destination drive:  " & $CheckDestinationFolder & " exists and is accessible....SUCCESS: DRIVE READY (Using TrueCrypt Container)")
                EndIf
                EndIf

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Attempting to mount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....MOUNTED

Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....
Attempting to open job list file:  D:\Programs\backups\robocopy.ini ....SUCCESSFUL

Processing jobs....

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DATO /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Checking source folder:  "D:\Temp" exists....
Job number:  1  Checking source folder:  "D:\Temp" exists....SUCCESS
Job number:  1  Checking destination drive:  H exists and is accessible....
Job number:  1  Checking destination drive:  H exists and is accessible....SUCCESS: DRIVE READY
Job number:  1  ROBOCOPY reports:  NO CHANGE **** PARTIAL SUCCESS **** - CHECK ROBOCOPY LOG OR FURTHER INFO

1  total jobs submitted for  processing
1  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....FAILED
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED

Okay, script updated

Added:

* Checking for network paths as source/destination

* Domain/ComputerName extracted from path, Domain/ComputerName is then pinged to make sure it exists, is it passes then the share name is tested, if that passes, the copy job continues, otherwise as with other failures, it skips to the next job

Changed:

* Some of the text and labels, for example SUCCESS is replaced by OK

* Generally shortened long output strings as much as i thought i could and remain informative.

I thought id attach the script this time instead of bloating the thread any further. Just need to rename the extension from .txt to .au3 (the forum doesnt allow uploading of .au3)

tcrobocopy.txt

As for your unmounting error, all i can say is that iuve looked into it from several angles and the only reason it can fail unmounting is if you have files to the truecrypt volume open. Dont have any programs trying to or actually accessing the volume. Make sure you dont have say explorer browsing that folder while the script is running...tat is as i may have said before, ids THE ONLY way i can get it to fail.

I don't get permission errors for robocopy anymore, so that is working better. But the drive still doesn't mount. It says it's mounted but it never actually mounts.

I think I found the problem. Notice this in the copy log:

Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" [b]/lx[/b] /p password

There should be a space between the /l and the x. I'm not sure how to fix it.

Copylog

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Programs\Backups\backups.au3"    

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Mounting truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Mounting truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...MOUNTED

Open job list file:  D:\Programs\backups\Robocopy.ini ...
Open job list file:  D:\Programs\backups\Robocopy.ini ...OK

Processing jobs...

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DT /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Source:  D:\Temp exists...
Job number:  1  Source:  D:\Temp exists...OK
Job number:  1  Destination:  H:\Temp exists...
Job number:  1  Destination:  H exists and is accessible....
Job number:  1  Destination:  H exists...OK: DRIVE READY
Job number:  1  ROBOCOPY reports:  NO CHANGE **** PARTIAL SUCCESS **** - CHECK ROBOCOPY LOG OR FURTHER INFO

1  total jobs submitted for  processing
1  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...FAIL
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED>Exit code: 0    Time: 2.814

Job_1_robocopy.log

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Fri Aug 06 12:03:59 2010

   Source : D:\Temp\
     Dest : H:\Temp\

    Files : *.*

  Options : *.* /S /E /COPY:DT /DCOPY:T /PURGE /MIR /XA:H /R:1000000 /W:30 

------------------------------------------------------------------------------

	                   0	D:\Temp\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :         0         0         0         0         0         0
   Bytes :         0         0         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

   Ended : Fri Aug 06 12:03:59 2010

I don't get permission errors for robocopy anymore, so that is working better. But the drive still doesn't mount. It says it's mounted but it never actually mounts.

I think I found the problem. Notice this in the copy log:

Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" [b]/lx[/b] /p password

There should be a space between the /l and the x. I'm not sure how to fix it.

Copylog

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Programs\Backups\backups.au3"    

User Credentials:  ACCEPTED
User Credentials:  Username and/or Password recognised on:  UPSTAIRS

Mounting truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...
Using command line:  "C:\Program Files\TeraCopy\TrueCrypt.exe" /q /v "\\DOWNSTAIRS\Locked$\backups" /lx /p password
Mounting truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...MOUNTED

Open job list file:  D:\Programs\backups\Robocopy.ini ...
Open job list file:  D:\Programs\backups\Robocopy.ini ...OK

Processing jobs...

Job number:  1  starting...
Job number:  1  RoboCopy Options:  /mir /dcopy:T /copy:DT /xa:h
Job number:  1  Source Folder:  "D:\Temp"
Job number:  1  Destination Folder:  "H:\Temp"
Job number:  1  Source:  D:\Temp exists...
Job number:  1  Source:  D:\Temp exists...OK
Job number:  1  Destination:  H:\Temp exists...
Job number:  1  Destination:  H exists and is accessible....
Job number:  1  Destination:  H exists...OK: DRIVE READY
Job number:  1  ROBOCOPY reports:  NO CHANGE **** PARTIAL SUCCESS **** - CHECK ROBOCOPY LOG OR FURTHER INFO

1  total jobs submitted for  processing
1  of  1  jobs completed successfully

Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ...FAIL
ExitCode:  0TrueCrypt returned error:  0
Attempting to unmount truecrypt volume:  "\\DOWNSTAIRS\Locked$\backups"  on drive letter:  x ....UNMOUNTED>Exit code: 0    Time: 2.814

Job_1_robocopy.log

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Fri Aug 06 12:03:59 2010

   Source : D:\Temp\
     Dest : H:\Temp\

    Files : *.*

  Options : *.* /S /E /COPY:DT /DCOPY:T /PURGE /MIR /XA:H /R:1000000 /W:30 

------------------------------------------------------------------------------

	                   0	D:\Temp\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :         0         0         0         0         0         0
   Bytes :         0         0         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

   Ended : Fri Aug 06 12:03:59 2010

I hate to tell you, but theres no difference whether you put a space in there or not.

Ive made some more changes and will post it after i test, after i get some sleep, its almost 5am here....

It makes a difference when I do it at the command line.

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \\DOWNSTAIRS\Locked$\backups /l X /p password /s /q

Works.

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \\DOWNSTAIRS\Locked$\backups /lX /p password /s /q

Does not work. No errors, but the volume doesn't mount.

It makes a difference when I do it at the command line.

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \\DOWNSTAIRS\Locked$\backups /l X /p password /s /q

Works.

"C:\Program Files\TrueCrypt\TrueCrypt.exe" /v \\DOWNSTAIRS\Locked$\backups /lX /p password /s /q

Does not work. No errors, but the volume doesn't mount.

Then you must have the only system in the world that does that because, quoting from the truecrypt documentation for mounting and unmounting (examples):

Dismount a volume mounted as the drive letter X (the main program window will not be displayed):

truecrypt /q /dx


Mount a volume called myvolume.tc using the password MyPassword, as the drive letter X. TrueCrypt will open an explorer window and beep; mounting will be automatic:

truecrypt /v myvolume.tc /lx /a /p MyPassword /e /b

Ill put the space in, but seriously, theres something weird in that i and the rest of the planet can use it without a space.

Okay

Added:

* Added/Left space after tc drive letter in command line for both mounting and unmounting

* Check that tc volume is still mounted BEFORE trying to unmount it (seemed a sane thing to do:) ) should clear up the errors you were getting when tc volume wasnt mounted in the first place

* A few other changes in the handling of errors when trying to copy to a tc volume that doesnt exist because it wasnt mounted!

tcrobocopy.txt

Okay

Fixed:

* incorrect order of robocopy options (i finally read a manual)

Added:

* summary counters for excluded jobs (jobs in the ini file with a # in front of the number) and jobs with errors

* date time stamping of log file(s)

2 versions:

v1 - Outputs separate log files for the main script output and each job

tcrobocopy_seperate_logs..txt

v2 (at request of OP) - Outputs all script and robocopy output to the one log file

tcrobocopy_all_in_one_log..txt

  • 4 months later...

I was trying to find a solution for this problem, converting .bat files to .exe will not ever solve the problem because any intermediate programmer can get the password easily so I?ve created a new command line tool that can help many others like us to encrypt the .bat file using X509 certificate.

You can find my tool under: http://securebatch.codeplex.com/

Enjoy it!

-Firas

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Microsoft confirms Windows 11 26H2 to finally get one of the most requested features by Sayan Sen This past week Microsoft officially confirmed Windows 11 version 26H2 with the latest build, 26300.8697, for testing in the experimental Insider channel. The company also published more details about it mainly directed towards IT admins and system admins. Essentially version 26H2 will be delivered via an enablement package (eKB) over Windows 11 25H2. If you are wondering about some of the upcoming features in the next Windows version, one of them is certainly very interesting as Microsoft has confirmed it is finally bringing one of the most overwhelmingly requested features ever. March Rogers, the Partner Director of Design at Microsoft, recently highlighted some of the Search improvements that the company is testing, and during the interaction with users on X where he posted it, Rogers also confirmed that the company is working on disabling web search results inside Search. This is something which many users find quite annoying as Windows would often serve them links to Bing which it feels could be more helpful rather than bringing up the actual object or app the user may be searching for on their PC. Finally though the company is prioritizing local file search over the web. However the feature could not be disabled for many users as not all new features are immediately rolled out to everyone. Image via phantomofearth (X) Windows enthusiast phantomofearth who likes to dig deep into new builds uncovered the IDs you will need to enable these features. Using the following feature IDs the new Search-related features landing in Windows 11 26H2 can be used. Follow the steps below to enable the new Search experience on Windows 11 build 26300.8697: Download ViveTool from GitHub and unpack the files in a convenient and easy-to-find folder. Press Win + X and select Terminal (Admin). Switch Windows Terminal to the Command Prompt profile with the Ctrl + Shift + 2 shortcut or by clicking the arrow-down button at the top of the window. Navigate to the folder containing the ViveTool files with the CD command. For example, if you have placed ViveTool in C:\Vive, type CD C:\Vive. Type vivetool /enable /id: and press Enter. Restart your computer. If you change your mind and want to restore, repeat the steps above and replace /enable with /disable in the commands on steps 5 and 6. Delightedly and perhaps also expectedly, once you disable web search and other such bloat, the Windows 11 Search is said to get snappier as remarked by another Windows enthusiast Xeno.
    • Makes me think of Family Guy - "Carl Sagan's Cosmos... edited for Rednecks" 🤣 https://www.youtube.com/watch?v=Ljt5iESYA7k&t=2s
    • Microsoft PC Manager 3.21.7.0 (Offline Installer) by Razvan Serea With Microsoft PC Manager, users can easily perform basic computer maintenance and enhance the speed of their devices with just one click. This app offers a range of features, including disk cleanup, startup app management, virus scanning, Windows Update checks, process monitoring, and storage management. Microsoft PC Manager key features: Storage Manager- easily uninstall infrequently used apps, manage large files, perform a cleanup, and set up Storage Sense to automatically clear temporary files. Health Checkup feature -scans for potential problems, viruses, and startup programs to turn off. It helps you identify unnecessary items to remove, optimizing your system's performance. Pop-up Management - block pop-up windows from appearing in apps. Windows Update - scans your system for any pending updates. Startup Apps - enable or disable startup apps on your PC, allowing you to optimize your system's startup performance. Browser Protection - rest assured that harmful programs cannot alter your default browser. Also enables you to change your default browser. Process Management - allows you to conveniently terminate any active process, ensuring optimal system performance and resource utilization. Anti-virus protection - Fully integrated with Windows Security. Safeguard your PC anytime. Quick Steps: Download Microsoft PC Manager Offline Installer (APPX/MSIX) with Adguard Adguard serves as a third-party online service, offering a user-friendly method for directly downloading appx, appxbundle, and msixbundle files from the Microsoft Store. Official download links will be generated for both the app's various versions and its dependency packages. How to download Microsoft PC Manager Offline Installer (APPX/MSIX) 1. Initially, you must find the app URL within the Microsoft Store. Access the Microsoft Store via your browser and search for "Microsoft PC Manager". Once located, copy the app URL, which includes the product ID, either from the address bar or from the provided link below. https://apps.microsoft.com/detail/9PM860492SZD 2. Now paste the app URL into the designated area, then click the check mark button to produce a direct download link. 3. To download, right-click the relevant link and select “Save link as…” from your browser's menu. Occasionally, Microsoft Edge may flag the download as insecure. In such cases, consider utilizing alternative browsers such as Google Chrome or Firefox to successfully complete the download. Microsoft PC Manager is a completely free tool optimized exclusively for use on Windows 10 (19042.0 and above) and Windows 11. Download: Microsoft PC Manager 3.21.7.0 | from Microsoft Store View: Microsoft PC Manager Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • jspaint is a lot better, if you like the classic mspaint experience and hate the new bloated Paint.
    • Amazon takes hundreds of dollars off its Kindle readers ahead Prime Day by Taras Buria Ahead of its Prime Day, Amazon brought its Kindle readers to all-time low prices, allowing you to save on various bundles across the entire lineup, from the most affordable Kindle to the flagship Scribe and its color-enabled variant. Kindle Essentials Bundle - $108.97 | 33% off This 6-inch Kindle is a portable reader with a front light, a brighter E-Ink display, and up to 6 weeks on a single charge. The bundle includes a protective case and a charger, so that you have everything you need for comfortable reading. Kindle Paperwhite Bundle - $154.98 | 45% off Kindle Colorsoft Bundle - $169.98 | 48% off The latest Paperwite is a 7-inch reader that features significantly faster page-turning, wireless charging, an ambient light sensor, 32GB of storage, and up to 12 weeks on a single charge. Right now, the bundle with a sling bag makes the Paperwhite 25% cheaper than the non-bundle variant. The same bundle is available for the Colorsoft version with a colorful E-Ink display. Kindle Scribe 32GB Bundle - $444.97 | 27% off Kindle Scribe Colorsoft 64GB Bundle - $574.97 | 27% off The Scribe is the biggest, flagship Kindle. It has an 11-inch texturized display with a stylus support, with a big emphasis on the note-taking experience. The built-in notebook has AI-assisted features for search, refinements, summarization, and more. The Scribe comes with 32GB of storage, and the bundle gets you a case, a stylus, and a protective case. Like with the Paperwhite, there is a Colorsoft version, which is also available with a massive discount. Note: These deals are available to Prime members only. If you do not have Prime, you can sign up using one of the links below. Good to know This Amazon deal is U.S. specific, and not available in other regions unless specified. We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only. Check out Today's Deals on Amazon | or our recent tech deals. Become a Prime member (for Students or SNAP) via Neowin Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP) Subscribe to Prime Video, Audible Plus, Music Unlimited or Kindle Unlimited via Neowin As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • Dedicated
      Almohandis earned a badge
      Dedicated
    • Dedicated
      JuvenileDelinquent earned a badge
      Dedicated
    • First Post
      DrWankel earned a badge
      First Post
    • Reacting Well
      DrWankel earned a badge
      Reacting Well
    • Week One Done
      Supreme Spray LV earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      504
    2. 2
      +Edouard
      174
    3. 3
      PsYcHoKiLLa
      84
    4. 4
      Steven P.
      76
    5. 5
      Michael Scrip
      76
  • Tell a friend

    Love Neowin? Tell a friend!