Scheduling a .bat file

.bat file:

:: Get FTP files
ECHO OFF
CLS
rem ECHO Getting FTP files...

rem "C:\Program Files (x86)\coreftp\coreftp.exe" -s -O -site ISI -d /*.zip -p "F:\TeamDB\New backups"

ECHO Extracting zips...
fastzip -x -overwrite=always "F:\TeamDB\New backups\db.zip" .
fastzip -x -overwrite=always "F:\TeamDB\New backups\files.zip" "F:\TeamDB\New backups\ISIFiles"

::SET VARIABLES

set DBNAME=ISP-MIS
set DBDIRECTORY=F:\ISI Databases
::rem set DBDIRECTORY=D:\Databases

ECHO Restoring %DBNAME% Database

ECHO PUT DATABASE IN SINGLE USER MODE TO ALLOW RESTORE
osql -S ISI-SQL\ISIDB -E -d master -Q "alter database [%DBNAME%] set single_user with rollback immediate"

ECHO RESTORE DATABASE
:: rem osql -S ISI-SQL\ISIDB -E -d master -Q "restore FILELISTONLY from disk='%~dp0\%DBNAME%.bak' "

sqlcmd -S ISI-SQL\ISIDB -E -d master -Q "restore database [ISP-MIS] from disk='%~dp0\ISP-MIS.bak' WITH MOVE 'R%DBNAME%_Data' TO '%DBDIRECTORY%\%DBNAME%.MDF',  MOVE 'R%DBNAME%_Log' TO '%DBDIRECTORY%\%DBNAME%_Log.LDF', REPLACE "

::GRANT PERMISSION TO ASPNET USER
::rem osql -S ISI-SQL\ISIDB -E -d %DBNAME% -Q "sp_grantdbaccess '%COMPUTERNAME%\ASPNET'"
::rem osql -S ISI-SQL\ISIDB -E -d %DBNAME% -Q "sp_addrolemember 'db_owner', '%COMPUTERNAME%\ASPNET'"

ECHO RESTORE TO MULTI USER
osql -S ISI-SQL\ISIDB -E -d master -Q "alter database [%DBNAME%] set multi_user"

Open in new window


The above is a .bat which works perfectly when actioned manually and it updates my SQL database
If I set up a scheduled task, the task runs but the file does not work through all of the scripts and the sql database is NOT updated
I have tried many different ways of setting up the scheduled task but no result
Suggestions please
doctorbillTechAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical SpeakerCommented:
What is the user that you specify when create the scheduled task?
The user that you specify is the user that will run the script so must have the correct rigths
Tom CieslikIT EngineerCommented:
Make sure is going to run under computer/domain admin and user log-in is not required.
Capture.JPG
Shaun VermaakTechnical SpecialistCommented:
Is osql, sqlcmd, fastzip in the system path?
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

slightwv (䄆 Netminder) Commented:
I agree with Shaun that it is likely an environment/PATH issue.

I wanted to suggest you redirect the BAT output to a file when it runs as a scheduled task.  When you look at the output of the run it should be obvious what the issue is.  I'm betting if cannot find the programs in the PATH.

Try setting the PATH in the BAT file itself and see if it runs correctly.
NVITEnd-user supportCommented:
Also... Are F: and D: local or network drives?
Doug BishopDatabase DeveloperCommented:
It could be either the user or path. I don't suspect the path because he can execute the script from his console. The user context under which the script is executed is the one that will be used to obtain the connection to SQL Server as Tom pointed out. If you are the one with the trusted credentials, make sure it is running under your user.

The suggestion to redirect your output to a log file will be very helpful.
use:
task.bat >> %USERPROFILE%\documents\task.log
to redirect console output to a log file in your documents directory.
slightwv (䄆 Netminder) Commented:
To add to the above logging, you'll want stderr as well:
task.bat >> %USERPROFILE%\documents\task.log 2>&1
DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical SpeakerCommented:
try specify the full path of every tools:
fastzip
sqlcmd
osql

and how slightwv suggest you must log what the bat do when is scheduled for undestand where is the error
doctorbillTechAuthor Commented:
The answer to the above suggestions is yes to every one except the output. Where do I put the output script in my batch file please
DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical SpeakerCommented:
You can simple put some echo on file for understand what command fail..

For example:

SET LOGFILE=D:\log.txt

ECHO Start Execute Command 1 > %LOGFILE%
command 1

ECHO Start Execute Command 2 >> %LOGFILE%
command 2

ECHO End of the script >> %LOGFILE%
Doug BishopDatabase DeveloperCommented:
My comment along with slightwv's shows you how to redirect to a file

task.bat >> %USERPROFILE%\documents\task.log 2>&1

Open in new window


This will output to a file named task.log in your documents directory.
doctorbillTechAuthor Commented:
Will try and report back
doctorbillTechAuthor Commented:
This is the result of running the .bat file from cmd:
The database was updated successfully BUT this does not happen when run from the task scheduler
--------

F:\TeamDB\New backups>ECHO OFF
Extracting zips...
Extracting Zip
Extracting Zip
Restoring ISP-MIS Database
PUT DATABASE IN SINGLE USER MODE TO ALLOW RESTORE
RESTORE DATABASE
Processed 1955864 pages for database 'ISP-MIS', file 'RISP-MIS_Data' on file 1.
Processed 16624 pages for database 'ISP-MIS', file 'ftrow_InspectionsFti' on file 1.
Processed 9 pages for database 'ISP-MIS', file 'RISP-MIS_Log' on file 1.
Converting database 'ISP-MIS' from version 661 to the current version 869.
Database 'ISP-MIS' running the upgrade step from version 661 to version 668.
Database 'ISP-MIS' running the upgrade step from version 668 to version 669.
Database 'ISP-MIS' running the upgrade step from version 669 to version 670.
Database 'ISP-MIS' running the upgrade step from version 670 to version 671.
Database 'ISP-MIS' running the upgrade step from version 671 to version 672.
Database 'ISP-MIS' running the upgrade step from version 672 to version 673.
Database 'ISP-MIS' running the upgrade step from version 673 to version 674.
Database 'ISP-MIS' running the upgrade step from version 674 to version 675.
Database 'ISP-MIS' running the upgrade step from version 675 to version 676.
Database 'ISP-MIS' running the upgrade step from version 676 to version 677.
Database 'ISP-MIS' running the upgrade step from version 677 to version 679.
Database 'ISP-MIS' running the upgrade step from version 679 to version 680.
Database 'ISP-MIS' running the upgrade step from version 680 to version 681.
Database 'ISP-MIS' running the upgrade step from version 681 to version 682.
Database 'ISP-MIS' running the upgrade step from version 682 to version 683.
Database 'ISP-MIS' running the upgrade step from version 683 to version 684.
Database 'ISP-MIS' running the upgrade step from version 684 to version 685.
Database 'ISP-MIS' running the upgrade step from version 685 to version 686.
Database 'ISP-MIS' running the upgrade step from version 686 to version 687.
Database 'ISP-MIS' running the upgrade step from version 687 to version 688.
Database 'ISP-MIS' running the upgrade step from version 688 to version 689.
Database 'ISP-MIS' running the upgrade step from version 689 to version 690.
Database 'ISP-MIS' running the upgrade step from version 690 to version 691.
Database 'ISP-MIS' running the upgrade step from version 691 to version 692.
Database 'ISP-MIS' running the upgrade step from version 692 to version 693.
Database 'ISP-MIS' running the upgrade step from version 693 to version 694.
Database 'ISP-MIS' running the upgrade step from version 694 to version 695.
Database 'ISP-MIS' running the upgrade step from version 695 to version 696.
Database 'ISP-MIS' running the upgrade step from version 696 to version 697.
Database 'ISP-MIS' running the upgrade step from version 697 to version 698.
Database 'ISP-MIS' running the upgrade step from version 698 to version 699.
Database 'ISP-MIS' running the upgrade step from version 699 to version 700.
Database 'ISP-MIS' running the upgrade step from version 700 to version 701.
Database 'ISP-MIS' running the upgrade step from version 701 to version 702.
Database 'ISP-MIS' running the upgrade step from version 702 to version 703.
Database 'ISP-MIS' running the upgrade step from version 703 to version 704.
Database 'ISP-MIS' running the upgrade step from version 704 to version 705.
Database 'ISP-MIS' running the upgrade step from version 705 to version 706.
Database 'ISP-MIS' running the upgrade step from version 706 to version 770.
Database 'ISP-MIS' running the upgrade step from version 770 to version 771.
Database 'ISP-MIS' running the upgrade step from version 771 to version 772.
Database 'ISP-MIS' running the upgrade step from version 772 to version 773.
Database 'ISP-MIS' running the upgrade step from version 773 to version 774.
Database 'ISP-MIS' running the upgrade step from version 774 to version 775.
Database 'ISP-MIS' running the upgrade step from version 775 to version 776.
Database 'ISP-MIS' running the upgrade step from version 776 to version 777.
Database 'ISP-MIS' running the upgrade step from version 777 to version 778.
Database 'ISP-MIS' running the upgrade step from version 778 to version 779.
Database 'ISP-MIS' running the upgrade step from version 779 to version 780.
Database 'ISP-MIS' running the upgrade step from version 780 to version 781.
Database 'ISP-MIS' running the upgrade step from version 781 to version 782.
Database 'ISP-MIS' running the upgrade step from version 782 to version 801.
Database 'ISP-MIS' running the upgrade step from version 801 to version 802.
Database 'ISP-MIS' running the upgrade step from version 802 to version 803.
Database 'ISP-MIS' running the upgrade step from version 803 to version 804.
Database 'ISP-MIS' running the upgrade step from version 804 to version 805.
Database 'ISP-MIS' running the upgrade step from version 805 to version 806.
Database 'ISP-MIS' running the upgrade step from version 806 to version 807.
Database 'ISP-MIS' running the upgrade step from version 807 to version 808.
Database 'ISP-MIS' running the upgrade step from version 808 to version 809.
Database 'ISP-MIS' running the upgrade step from version 809 to version 810.
Database 'ISP-MIS' running the upgrade step from version 810 to version 811.
Database 'ISP-MIS' running the upgrade step from version 811 to version 812.
Database 'ISP-MIS' running the upgrade step from version 812 to version 813.
Database 'ISP-MIS' running the upgrade step from version 813 to version 814.
Database 'ISP-MIS' running the upgrade step from version 814 to version 815.
Database 'ISP-MIS' running the upgrade step from version 815 to version 816.
Database 'ISP-MIS' running the upgrade step from version 816 to version 817.
Database 'ISP-MIS' running the upgrade step from version 817 to version 818.
Database 'ISP-MIS' running the upgrade step from version 818 to version 819.
Database 'ISP-MIS' running the upgrade step from version 819 to version 820.
Database 'ISP-MIS' running the upgrade step from version 820 to version 821.
Database 'ISP-MIS' running the upgrade step from version 821 to version 822.
Database 'ISP-MIS' running the upgrade step from version 822 to version 823.
Database 'ISP-MIS' running the upgrade step from version 823 to version 824.
Database 'ISP-MIS' running the upgrade step from version 824 to version 825.
Database 'ISP-MIS' running the upgrade step from version 825 to version 826.
Database 'ISP-MIS' running the upgrade step from version 826 to version 827.
Database 'ISP-MIS' running the upgrade step from version 827 to version 828.
Database 'ISP-MIS' running the upgrade step from version 828 to version 829.
Database 'ISP-MIS' running the upgrade step from version 829 to version 830.
Database 'ISP-MIS' running the upgrade step from version 830 to version 831.
Database 'ISP-MIS' running the upgrade step from version 831 to version 832.
Database 'ISP-MIS' running the upgrade step from version 832 to version 833.
Database 'ISP-MIS' running the upgrade step from version 833 to version 834.
Database 'ISP-MIS' running the upgrade step from version 834 to version 835.
Database 'ISP-MIS' running the upgrade step from version 835 to version 836.
Database 'ISP-MIS' running the upgrade step from version 836 to version 837.
Database 'ISP-MIS' running the upgrade step from version 837 to version 838.
Database 'ISP-MIS' running the upgrade step from version 838 to version 839.
Database 'ISP-MIS' running the upgrade step from version 839 to version 840.
Database 'ISP-MIS' running the upgrade step from version 840 to version 841.
Database 'ISP-MIS' running the upgrade step from version 841 to version 842.
Database 'ISP-MIS' running the upgrade step from version 842 to version 843.
Database 'ISP-MIS' running the upgrade step from version 843 to version 844.
Database 'ISP-MIS' running the upgrade step from version 844 to version 845.
Database 'ISP-MIS' running the upgrade step from version 845 to version 846.
Database 'ISP-MIS' running the upgrade step from version 846 to version 847.
Database 'ISP-MIS' running the upgrade step from version 847 to version 848.
Database 'ISP-MIS' running the upgrade step from version 848 to version 849.
Database 'ISP-MIS' running the upgrade step from version 849 to version 850.
Database 'ISP-MIS' running the upgrade step from version 850 to version 851.
Database 'ISP-MIS' running the upgrade step from version 851 to version 852.
Database 'ISP-MIS' running the upgrade step from version 852 to version 853.
Database 'ISP-MIS' running the upgrade step from version 853 to version 854.
Database 'ISP-MIS' running the upgrade step from version 854 to version 855.
Database 'ISP-MIS' running the upgrade step from version 855 to version 856.
Database 'ISP-MIS' running the upgrade step from version 856 to version 857.
Database 'ISP-MIS' running the upgrade step from version 857 to version 858.
Database 'ISP-MIS' running the upgrade step from version 858 to version 859.
Database 'ISP-MIS' running the upgrade step from version 859 to version 860.
Database 'ISP-MIS' running the upgrade step from version 860 to version 861.
Database 'ISP-MIS' running the upgrade step from version 861 to version 862.
Database 'ISP-MIS' running the upgrade step from version 862 to version 863.
Database 'ISP-MIS' running the upgrade step from version 863 to version 864.
Database 'ISP-MIS' running the upgrade step from version 864 to version 865.
Database 'ISP-MIS' running the upgrade step from version 865 to version 866.
Database 'ISP-MIS' running the upgrade step from version 866 to version 867.
Database 'ISP-MIS' running the upgrade step from version 867 to version 868.
Database 'ISP-MIS' running the upgrade step from version 868 to version 869.
RESTORE DATABASE successfully processed 1972497 pages in 56.850 seconds (271.066 MB/sec).
RESTORE TO MULTI USER
slightwv (䄆 Netminder) Commented:
>>This is the result of running the .bat file from cmd:

We are after the logs when running scheduled.  You already stated it runs fine when you run it manually.  We need to see the output when it doesn't.
doctorbillTechAuthor Commented:
Yes but How do I output the data from a scheduled task
doctorbillTechAuthor Commented:
Do I just reference the .bat file
slightwv (䄆 Netminder) Commented:
When you provide the command to schedule, instead of task.bat, provide the full command we have suggested:
task.bat >> %USERPROFILE%\documents\task.log 2>&1

Open in new window

DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical SpeakerCommented:
Yes or you simply call a bat that call the bat:

tasklog.bat:

call task.bat >> %USERPROFILE%\documents\task.log 2>&1
doctorbillTechAuthor Commented:
ok - will do
Is this what you mean (See attached file)
doctorbillTechAuthor Commented:
slightwv (䄆 Netminder) Commented:
That should work.  I was thinking adding it all on the program line but adding it as a parameter should also work.

Creating a temp BAT file as suggested above should also work.
doctorbillTechAuthor Commented:
It didn't work, either as an argument or as a  full script
slightwv (䄆 Netminder) Commented:
Then try creating a testlog.bat script with the command and schedule that.
doctorbillTechAuthor Commented:
I don't understand what you are asking. Can you give me an example of the scheduled task to create
doctorbillTechAuthor Commented:
ie how do I call the testlog.bat from the task
slightwv (䄆 Netminder) Commented:
Open notepad.

Paste this in:
call task.bat >> %USERPROFILE%\documents\task.log 2>&1

Then select File/Save As.

Give it a name C:\TEMP\mytestfile.bat or any name you want but make sure it ends with .BAT.

Then schedule C:\TEMP\mytestfile.bat or whatever name you gave it instead of task.bat or whatever the script is you are calling now.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
doctorbillTechAuthor Commented:
Result:
Awesome
Looks like the fastzip is causing the problem
No idea why it works when manually starting the  script .bat file but not from a scheduled task
Path location maybe ????
---------------------------

C:\Windows\system32>ECHO OFF
Extracting zips...
'fastzip' is not recognized as an internal or external command,
operable program or batch file.
'fastzip' is not recognized as an internal or external command,
operable program or batch file.
Restoring ISP-MIS Database
PUT DATABASE IN SINGLE USER MODE TO ALLOW RESTORE
RESTORE DATABASE
Processed 1955864 pages for database 'ISP-MIS', file 'RISP-MIS_Data' on file 1.
Processed 16624 pages for database 'ISP-MIS', file 'ftrow_InspectionsFti' on file 1.
Processed 9 pages for database 'ISP-MIS', file 'RISP-MIS_Log' on file 1.
Converting database 'ISP-MIS' from version 661 to the current version 869.
Database 'ISP-MIS' running the upgrade step from version 661 to version 668.
Database 'ISP-MIS' running the upgrade step from version 668 to version 669.
Database 'ISP-MIS' running the upgrade step from version 669 to version 670.
Database 'ISP-MIS' running the upgrade step from version 670 to version 671.
Database 'ISP-MIS' running the upgrade step from version 671 to version 672.
Database 'ISP-MIS' running the upgrade step from version 672 to version 673.
Database 'ISP-MIS' running the upgrade step from version 673 to version 674.
Database 'ISP-MIS' running the upgrade step from version 674 to version 675.
Database 'ISP-MIS' running the upgrade step from version 675 to version 676.
Database 'ISP-MIS' running the upgrade step from version 676 to version 677.
Database 'ISP-MIS' running the upgrade step from version 677 to version 679.
Database 'ISP-MIS' running the upgrade step from version 679 to version 680.
Database 'ISP-MIS' running the upgrade step from version 680 to version 681.
Database 'ISP-MIS' running the upgrade step from version 681 to version 682.
Database 'ISP-MIS' running the upgrade step from version 682 to version 683.
Database 'ISP-MIS' running the upgrade step from version 683 to version 684.
Database 'ISP-MIS' running the upgrade step from version 684 to version 685.
Database 'ISP-MIS' running the upgrade step from version 685 to version 686.
Database 'ISP-MIS' running the upgrade step from version 686 to version 687.
Database 'ISP-MIS' running the upgrade step from version 687 to version 688.
Database 'ISP-MIS' running the upgrade step from version 688 to version 689.
Database 'ISP-MIS' running the upgrade step from version 689 to version 690.
Database 'ISP-MIS' running the upgrade step from version 690 to version 691.
Database 'ISP-MIS' running the upgrade step from version 691 to version 692.
Database 'ISP-MIS' running the upgrade step from version 692 to version 693.
Database 'ISP-MIS' running the upgrade step from version 693 to version 694.
Database 'ISP-MIS' running the upgrade step from version 694 to version 695.
Database 'ISP-MIS' running the upgrade step from version 695 to version 696.
Database 'ISP-MIS' running the upgrade step from version 696 to version 697.
Database 'ISP-MIS' running the upgrade step from version 697 to version 698.
Database 'ISP-MIS' running the upgrade step from version 698 to version 699.
Database 'ISP-MIS' running the upgrade step from version 699 to version 700.
Database 'ISP-MIS' running the upgrade step from version 700 to version 701.
Database 'ISP-MIS' running the upgrade step from version 701 to version 702.
Database 'ISP-MIS' running the upgrade step from version 702 to version 703.
Database 'ISP-MIS' running the upgrade step from version 703 to version 704.
Database 'ISP-MIS' running the upgrade step from version 704 to version 705.
Database 'ISP-MIS' running the upgrade step from version 705 to version 706.
Database 'ISP-MIS' running the upgrade step from version 706 to version 770.
Database 'ISP-MIS' running the upgrade step from version 770 to version 771.
Database 'ISP-MIS' running the upgrade step from version 771 to version 772.
Database 'ISP-MIS' running the upgrade step from version 772 to version 773.
Database 'ISP-MIS' running the upgrade step from version 773 to version 774.
Database 'ISP-MIS' running the upgrade step from version 774 to version 775.
Database 'ISP-MIS' running the upgrade step from version 775 to version 776.
Database 'ISP-MIS' running the upgrade step from version 776 to version 777.
Database 'ISP-MIS' running the upgrade step from version 777 to version 778.
Database 'ISP-MIS' running the upgrade step from version 778 to version 779.
Database 'ISP-MIS' running the upgrade step from version 779 to version 780.
Database 'ISP-MIS' running the upgrade step from version 780 to version 781.
Database 'ISP-MIS' running the upgrade step from version 781 to version 782.
Database 'ISP-MIS' running the upgrade step from version 782 to version 801.
Database 'ISP-MIS' running the upgrade step from version 801 to version 802.
Database 'ISP-MIS' running the upgrade step from version 802 to version 803.
Database 'ISP-MIS' running the upgrade step from version 803 to version 804.
Database 'ISP-MIS' running the upgrade step from version 804 to version 805.
Database 'ISP-MIS' running the upgrade step from version 805 to version 806.
Database 'ISP-MIS' running the upgrade step from version 806 to version 807.
Database 'ISP-MIS' running the upgrade step from version 807 to version 808.
Database 'ISP-MIS' running the upgrade step from version 808 to version 809.
Database 'ISP-MIS' running the upgrade step from version 809 to version 810.
Database 'ISP-MIS' running the upgrade step from version 810 to version 811.
Database 'ISP-MIS' running the upgrade step from version 811 to version 812.
Database 'ISP-MIS' running the upgrade step from version 812 to version 813.
Database 'ISP-MIS' running the upgrade step from version 813 to version 814.
Database 'ISP-MIS' running the upgrade step from version 814 to version 815.
Database 'ISP-MIS' running the upgrade step from version 815 to version 816.
Database 'ISP-MIS' running the upgrade step from version 816 to version 817.
Database 'ISP-MIS' running the upgrade step from version 817 to version 818.
Database 'ISP-MIS' running the upgrade step from version 818 to version 819.
Database 'ISP-MIS' running the upgrade step from version 819 to version 820.
Database 'ISP-MIS' running the upgrade step from version 820 to version 821.
Database 'ISP-MIS' running the upgrade step from version 821 to version 822.
Database 'ISP-MIS' running the upgrade step from version 822 to version 823.
Database 'ISP-MIS' running the upgrade step from version 823 to version 824.
Database 'ISP-MIS' running the upgrade step from version 824 to version 825.
Database 'ISP-MIS' running the upgrade step from version 825 to version 826.
Database 'ISP-MIS' running the upgrade step from version 826 to version 827.
Database 'ISP-MIS' running the upgrade step from version 827 to version 828.
Database 'ISP-MIS' running the upgrade step from version 828 to version 829.
Database 'ISP-MIS' running the upgrade step from version 829 to version 830.
Database 'ISP-MIS' running the upgrade step from version 830 to version 831.
Database 'ISP-MIS' running the upgrade step from version 831 to version 832.
Database 'ISP-MIS' running the upgrade step from version 832 to version 833.
Database 'ISP-MIS' running the upgrade step from version 833 to version 834.
Database 'ISP-MIS' running the upgrade step from version 834 to version 835.
Database 'ISP-MIS' running the upgrade step from version 835 to version 836.
Database 'ISP-MIS' running the upgrade step from version 836 to version 837.
Database 'ISP-MIS' running the upgrade step from version 837 to version 838.
Database 'ISP-MIS' running the upgrade step from version 838 to version 839.
Database 'ISP-MIS' running the upgrade step from version 839 to version 840.
Database 'ISP-MIS' running the upgrade step from version 840 to version 841.
Database 'ISP-MIS' running the upgrade step from version 841 to version 842.
Database 'ISP-MIS' running the upgrade step from version 842 to version 843.
Database 'ISP-MIS' running the upgrade step from version 843 to version 844.
Database 'ISP-MIS' running the upgrade step from version 844 to version 845.
Database 'ISP-MIS' running the upgrade step from version 845 to version 846.
Database 'ISP-MIS' running the upgrade step from version 846 to version 847.
Database 'ISP-MIS' running the upgrade step from version 847 to version 848.
Database 'ISP-MIS' running the upgrade step from version 848 to version 849.
Database 'ISP-MIS' running the upgrade step from version 849 to version 850.
Database 'ISP-MIS' running the upgrade step from version 850 to version 851.
Database 'ISP-MIS' running the upgrade step from version 851 to version 852.
Database 'ISP-MIS' running the upgrade step from version 852 to version 853.
Database 'ISP-MIS' running the upgrade step from version 853 to version 854.
Database 'ISP-MIS' running the upgrade step from version 854 to version 855.
Database 'ISP-MIS' running the upgrade step from version 855 to version 856.
Database 'ISP-MIS' running the upgrade step from version 856 to version 857.
Database 'ISP-MIS' running the upgrade step from version 857 to version 858.
Database 'ISP-MIS' running the upgrade step from version 858 to version 859.
Database 'ISP-MIS' running the upgrade step from version 859 to version 860.
Database 'ISP-MIS' running the upgrade step from version 860 to version 861.
Database 'ISP-MIS' running the upgrade step from version 861 to version 862.
Database 'ISP-MIS' running the upgrade step from version 862 to version 863.
Database 'ISP-MIS' running the upgrade step from version 863 to version 864.
Database 'ISP-MIS' running the upgrade step from version 864 to version 865.
Database 'ISP-MIS' running the upgrade step from version 865 to version 866.
Database 'ISP-MIS' running the upgrade step from version 866 to version 867.
Database 'ISP-MIS' running the upgrade step from version 867 to version 868.
Database 'ISP-MIS' running the upgrade step from version 868 to version 869.
RESTORE DATABASE successfully processed 1972497 pages in 57.609 seconds (267.495 MB/sec).
RESTORE TO MULTI USER
slightwv (䄆 Netminder) Commented:
Yes, it's the PATH.


You can fully qualify the path everywhere for each command or in the BAT file itself, just add the necessary PATH.
DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical SpeakerCommented:
Try specify the full path of fastzip (see my second comment to this discuss)
doctorbillTechAuthor Commented:
I initially thought that as the fastzip was in the same directory as the .bat file that would be ok
Will try the full path
doctorbillTechAuthor Commented:
Latest:
Looks like that has done it
Thanks very much for your help on this
---------


C:\Windows\system32>ECHO OFF
Extracting zips...
Extracting Zip
Extracting Zip
Restoring ISP-MIS Database
PUT DATABASE IN SINGLE USER MODE TO ALLOW RESTORE
RESTORE DATABASE
Processed 1955864 pages for database 'ISP-MIS', file 'RISP-MIS_Data' on file 1.
Processed 16624 pages for database 'ISP-MIS', file 'ftrow_InspectionsFti' on file 1.
Processed 9 pages for database 'ISP-MIS', file 'RISP-MIS_Log' on file 1.
Converting database 'ISP-MIS' from version 661 to the current version 869.
Database 'ISP-MIS' running the upgrade step from version 661 to version 668.
Database 'ISP-MIS' running the upgrade step from version 668 to version 669.
Database 'ISP-MIS' running the upgrade step from version 669 to version 670.
Database 'ISP-MIS' running the upgrade step from version 670 to version 671.
Database 'ISP-MIS' running the upgrade step from version 671 to version 672.
Database 'ISP-MIS' running the upgrade step from version 672 to version 673.
Database 'ISP-MIS' running the upgrade step from version 673 to version 674.
Database 'ISP-MIS' running the upgrade step from version 674 to version 675.
Database 'ISP-MIS' running the upgrade step from version 675 to version 676.
Database 'ISP-MIS' running the upgrade step from version 676 to version 677.
Database 'ISP-MIS' running the upgrade step from version 677 to version 679.
Database 'ISP-MIS' running the upgrade step from version 679 to version 680.
Database 'ISP-MIS' running the upgrade step from version 680 to version 681.
Database 'ISP-MIS' running the upgrade step from version 681 to version 682.
Database 'ISP-MIS' running the upgrade step from version 682 to version 683.
Database 'ISP-MIS' running the upgrade step from version 683 to version 684.
Database 'ISP-MIS' running the upgrade step from version 684 to version 685.
Database 'ISP-MIS' running the upgrade step from version 685 to version 686.
Database 'ISP-MIS' running the upgrade step from version 686 to version 687.
Database 'ISP-MIS' running the upgrade step from version 687 to version 688.
Database 'ISP-MIS' running the upgrade step from version 688 to version 689.
Database 'ISP-MIS' running the upgrade step from version 689 to version 690.
Database 'ISP-MIS' running the upgrade step from version 690 to version 691.
Database 'ISP-MIS' running the upgrade step from version 691 to version 692.
Database 'ISP-MIS' running the upgrade step from version 692 to version 693.
Database 'ISP-MIS' running the upgrade step from version 693 to version 694.
Database 'ISP-MIS' running the upgrade step from version 694 to version 695.
Database 'ISP-MIS' running the upgrade step from version 695 to version 696.
Database 'ISP-MIS' running the upgrade step from version 696 to version 697.
Database 'ISP-MIS' running the upgrade step from version 697 to version 698.
Database 'ISP-MIS' running the upgrade step from version 698 to version 699.
Database 'ISP-MIS' running the upgrade step from version 699 to version 700.
Database 'ISP-MIS' running the upgrade step from version 700 to version 701.
Database 'ISP-MIS' running the upgrade step from version 701 to version 702.
Database 'ISP-MIS' running the upgrade step from version 702 to version 703.
Database 'ISP-MIS' running the upgrade step from version 703 to version 704.
Database 'ISP-MIS' running the upgrade step from version 704 to version 705.
Database 'ISP-MIS' running the upgrade step from version 705 to version 706.
Database 'ISP-MIS' running the upgrade step from version 706 to version 770.
Database 'ISP-MIS' running the upgrade step from version 770 to version 771.
Database 'ISP-MIS' running the upgrade step from version 771 to version 772.
Database 'ISP-MIS' running the upgrade step from version 772 to version 773.
Database 'ISP-MIS' running the upgrade step from version 773 to version 774.
Database 'ISP-MIS' running the upgrade step from version 774 to version 775.
Database 'ISP-MIS' running the upgrade step from version 775 to version 776.
Database 'ISP-MIS' running the upgrade step from version 776 to version 777.
Database 'ISP-MIS' running the upgrade step from version 777 to version 778.
Database 'ISP-MIS' running the upgrade step from version 778 to version 779.
Database 'ISP-MIS' running the upgrade step from version 779 to version 780.
Database 'ISP-MIS' running the upgrade step from version 780 to version 781.
Database 'ISP-MIS' running the upgrade step from version 781 to version 782.
Database 'ISP-MIS' running the upgrade step from version 782 to version 801.
Database 'ISP-MIS' running the upgrade step from version 801 to version 802.
Database 'ISP-MIS' running the upgrade step from version 802 to version 803.
Database 'ISP-MIS' running the upgrade step from version 803 to version 804.
Database 'ISP-MIS' running the upgrade step from version 804 to version 805.
Database 'ISP-MIS' running the upgrade step from version 805 to version 806.
Database 'ISP-MIS' running the upgrade step from version 806 to version 807.
Database 'ISP-MIS' running the upgrade step from version 807 to version 808.
Database 'ISP-MIS' running the upgrade step from version 808 to version 809.
Database 'ISP-MIS' running the upgrade step from version 809 to version 810.
Database 'ISP-MIS' running the upgrade step from version 810 to version 811.
Database 'ISP-MIS' running the upgrade step from version 811 to version 812.
Database 'ISP-MIS' running the upgrade step from version 812 to version 813.
Database 'ISP-MIS' running the upgrade step from version 813 to version 814.
Database 'ISP-MIS' running the upgrade step from version 814 to version 815.
Database 'ISP-MIS' running the upgrade step from version 815 to version 816.
Database 'ISP-MIS' running the upgrade step from version 816 to version 817.
Database 'ISP-MIS' running the upgrade step from version 817 to version 818.
Database 'ISP-MIS' running the upgrade step from version 818 to version 819.
Database 'ISP-MIS' running the upgrade step from version 819 to version 820.
Database 'ISP-MIS' running the upgrade step from version 820 to version 821.
Database 'ISP-MIS' running the upgrade step from version 821 to version 822.
Database 'ISP-MIS' running the upgrade step from version 822 to version 823.
Database 'ISP-MIS' running the upgrade step from version 823 to version 824.
Database 'ISP-MIS' running the upgrade step from version 824 to version 825.
Database 'ISP-MIS' running the upgrade step from version 825 to version 826.
Database 'ISP-MIS' running the upgrade step from version 826 to version 827.
Database 'ISP-MIS' running the upgrade step from version 827 to version 828.
Database 'ISP-MIS' running the upgrade step from version 828 to version 829.
Database 'ISP-MIS' running the upgrade step from version 829 to version 830.
Database 'ISP-MIS' running the upgrade step from version 830 to version 831.
Database 'ISP-MIS' running the upgrade step from version 831 to version 832.
Database 'ISP-MIS' running the upgrade step from version 832 to version 833.
Database 'ISP-MIS' running the upgrade step from version 833 to version 834.
Database 'ISP-MIS' running the upgrade step from version 834 to version 835.
Database 'ISP-MIS' running the upgrade step from version 835 to version 836.
Database 'ISP-MIS' running the upgrade step from version 836 to version 837.
Database 'ISP-MIS' running the upgrade step from version 837 to version 838.
Database 'ISP-MIS' running the upgrade step from version 838 to version 839.
Database 'ISP-MIS' running the upgrade step from version 839 to version 840.
Database 'ISP-MIS' running the upgrade step from version 840 to version 841.
Database 'ISP-MIS' running the upgrade step from version 841 to version 842.
Database 'ISP-MIS' running the upgrade step from version 842 to version 843.
Database 'ISP-MIS' running the upgrade step from version 843 to version 844.
Database 'ISP-MIS' running the upgrade step from version 844 to version 845.
Database 'ISP-MIS' running the upgrade step from version 845 to version 846.
Database 'ISP-MIS' running the upgrade step from version 846 to version 847.
Database 'ISP-MIS' running the upgrade step from version 847 to version 848.
Database 'ISP-MIS' running the upgrade step from version 848 to version 849.
Database 'ISP-MIS' running the upgrade step from version 849 to version 850.
Database 'ISP-MIS' running the upgrade step from version 850 to version 851.
Database 'ISP-MIS' running the upgrade step from version 851 to version 852.
Database 'ISP-MIS' running the upgrade step from version 852 to version 853.
Database 'ISP-MIS' running the upgrade step from version 853 to version 854.
Database 'ISP-MIS' running the upgrade step from version 854 to version 855.
Database 'ISP-MIS' running the upgrade step from version 855 to version 856.
Database 'ISP-MIS' running the upgrade step from version 856 to version 857.
Database 'ISP-MIS' running the upgrade step from version 857 to version 858.
Database 'ISP-MIS' running the upgrade step from version 858 to version 859.
Database 'ISP-MIS' running the upgrade step from version 859 to version 860.
Database 'ISP-MIS' running the upgrade step from version 860 to version 861.
Database 'ISP-MIS' running the upgrade step from version 861 to version 862.
Database 'ISP-MIS' running the upgrade step from version 862 to version 863.
Database 'ISP-MIS' running the upgrade step from version 863 to version 864.
Database 'ISP-MIS' running the upgrade step from version 864 to version 865.
Database 'ISP-MIS' running the upgrade step from version 865 to version 866.
Database 'ISP-MIS' running the upgrade step from version 866 to version 867.
Database 'ISP-MIS' running the upgrade step from version 867 to version 868.
Database 'ISP-MIS' running the upgrade step from version 868 to version 869.
RESTORE DATABASE successfully processed 1972497 pages in 55.240 seconds (278.966 MB/sec).
RESTORE TO MULTI USER
DevAdminSystem Engineer | .NET Developer | Microsoft MVP | Technical SpeakerCommented:
good and thanks for the feedback!
doctorbillTechAuthor Commented:
Thanks all
Very educational
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
task scheduler

From novice to tech pro — start learning today.