Scriptdirectory

I want to find the scriptdirectory for Deploy-application.ps1 which I am going to use in creating a scheduled task in task scheduler, but whenever i run $scriptDirectory it keeps pointing to AppDeploytoolkit folder and not to the Final folder where Deploy-Application.ps1 is?

Any Idea how to solve this?

$scriptParentPath
# If toolkit was invoked by another script: contains folder that the
# invoking script is located in.
# If toolkit was not invoked by another script: contains parent folder
# of the toolkit.

or

$scriptParentDir = split-path $scriptRoot -Parent
# Gets the parent dir of the script root dir