Problem with script

Please let us know how well we're fulfilling your needs!

Problem with script

by templargfx » Tue Jul 24, 2012 11:15 am

Hi All,

I am looking for assistance with why this script fails to execute. I was under the impression that scripting in BA was basically batch file scripting, however this script keeps erroring with the message "GOTO was unexpected at this time." error code 252

Here is the script :

Code: Select all
@echo off
for /f "delims=\" %%a in (%BACKUP_FILENAME%) do set DRIVELETTER=%%a
if %DRIVELETTER% == "c:" GOTO END
if %DRIVELETTER% == "C:" GOTO END
if %DRIVELETTER% == "d:" GOTO END
if %DRIVELETTER% == "D:" GOTO END
if %DRIVELETTER% == "" GOTO END
pushd %DRIVELETTER%
IF EXIST .catalogues (GOTO FOUND)
GOTO END

:FOUND
for /f "tokens=1-5*" %%1 in ('vol') do (
    set VOLUME=%%6 & GOTO FORMAT
)
:FORMAT
echo y | format %DRIVELETTER% /fs:ntfs /v:%VOLUME% /q/x
GOTO END

:END


The idea of the script is to format the external HDD before starting the backup, it works flawlessly as a batch file, but gives the above error when using it inside Backup Assist. Can anyone tell me why this error is occuring?
templargfx
User
 
Posts: 3
Joined: Tue Jul 24, 2012 11:08 am

Re: Problem with script

by TimN » Tue Jul 24, 2012 5:03 pm

Hi,

It's Tim from BackupAssist. Thanks for your post.

As you have noted the BackupAssist scripting area does not do anything different or perform additional tasks to what is performed from a command-line.

Whenever a script fails when ran directly from BackupAssist, we would suggest that you placed the script within a batch file and call this batch file from BackupAssist.

I hope this helps.

Regards,

Tim.
TimN
 

Re: Problem with script

by templargfx » Tue Jul 24, 2012 5:05 pm

I cant believe I did not think of that. I will try that tomorrow
templargfx
User
 
Posts: 3
Joined: Tue Jul 24, 2012 11:08 am

Re: Problem with script

by scpm » Sat Aug 11, 2012 6:47 am

It might help you to read through the help for start.exe and cmd.exe (help cmd.exe , start.exe /?)

I.e. Having BA call the script might not work, but calling C:\program files\system32\cmd.exe might.

You might try something like this:
C:\program files\system32\cmd.exe /A C:\YourScript.cmd > YourScript.log.txt 2>&1

(Not sure if BA captures Stdout or StdErr (2>&1) in which case you could remove the log text file creation)

I hope that helps!
-N
scpm
User
 
Posts: 117
Joined: Sat Mar 31, 2012 4:40 am
Location: California

Re: Problem with script

by templargfx » Tue Aug 14, 2012 8:11 am

Unfortunately directly calling the script just does nothing at all.

All I want is to have Backup Assist format or clear the external drive before starting the backup.

Im stumped on this :(
templargfx
User
 
Posts: 3
Joined: Tue Jul 24, 2012 11:08 am

Re: Problem with script

by TimN » Tue Aug 14, 2012 11:44 am

Hi,

It's Tim from BackupAssist. Sorry to hear that the issue with your script persists.

I have listed some basic scripts below that should format and delete the existing backup from the backup destination.

To format the backup drive:

format <driveletter>: /v:<volumename> /fs:ntfs /y /q /x

My example is below:

format f: /v:test /fs:ntfs /y /q /x


To remove existing image backup job


echo y |rd /S <path>


E.g: echo y |rd /S <f:\WindowsImageBackup>


Please not that we only provide basic scripts such as the ones above. We do not, however, provide specific support for user's scripts.


I hope this helps.

Regards,

Tim.
TimN
 


Return to Feedback and Feature Requests



Who is online

Users browsing this forum: No registered users and 1 guest

cron