fixes: #2670 pub global activate commands always exit cmd on windows. (#2671)

diff --git a/lib/src/global_packages.dart b/lib/src/global_packages.dart
index 257f7bf..773d324 100644
--- a/lib/src/global_packages.dart
+++ b/lib/src/global_packages.dart
@@ -708,15 +708,20 @@
         invocation = '''
 if exist "$snapshot" (
   dart "$snapshot" %*
-  rem The VM exits with code 253 if the snapshot version is out-of-date.	
-  rem If it is, we need to delete it and run "pub global" manually.	
-  if not errorlevel 253 (	
-    exit /b %errorlevel%	
+  rem The VM exits with code 253 if the snapshot version is out-of-date.
+  rem If it is, we need to delete it and run "pub global" manually.
+  if not errorlevel 253 (
+    goto error
   )
   pub global run ${package.name}:$script %*
 ) else (
   pub global run ${package.name}:$script %*
-)''';
+)
+goto eof
+:error
+exit /b %errorlevel%
+:eof
+''';
       } else {
         invocation = 'pub global run ${package.name}:$script %*';
       }