Batch file crashes when double clicked, but passes from command prompt

Posted by devinb on Stack Overflow See other posts from Stack Overflow or by devinb
Published on 2010-05-05T07:46:10Z Indexed on 2010/05/05 7:48 UTC
Read the original article Hit count: 185

Filed under:
|

I have a batch file that was crashing when executing from windows explorer. I opened a command prompt and navigated to the file, but when I executed it there it did not crash.

I identified the line that was crashing.

SET list =(Company.Framework^
           Company.SharePoint.Lists.News^
           Company.SharePoint.WebControls^
           Company.SharePoint.WebParts.NewsList^
           Company.SharePoint.WebParts.RedirectWebPart^
           Company.SharePoint.WebParts.IFrameWebPart^
           Company.SharePoint.WebParts.ItemRotatorWebPart^
           Company.SharePoint.WebParts.InteractiveMapWebPart^
           Company.SharePoint.WebParts.SiteMapWebPart^
           Company.SharePoint.Branding.PrettyUnicorns)

::Do stuff

::Failure occurs here
FOR %%F in %list% DO (
::Doesn't matter what is in here
ECHO Woo!
)

Is any reason why a batch file would behave differently from Windows Explorer vs Command Prompt?

© Stack Overflow or respective owner

Related posts about command-prompt

Related posts about batch