Sure, but I think you still need to provide the full path of the script. If you're inside a source folder very deep it will lead to something like:
dotnet script ../../../../../scrips/scaffold-something.cs
With npm run it works from any subdirectory: npm run scaffold-something