Error in batch files

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

 

When you create a batch file (*.bat) which should execute some shell-command you might get very strange error.
Following is an error, which is raised when trying to install Windows Service:

'´╗┐sc' is not recognized as an internal or external command,

This is obviously caused by encoding sequence injected in a front of the batch file. My batch file looked in this case as follows:

sc create "Daenet.IntegrationService.%1" binPath= "%2" …

You cannot see that in editor, but in a front of the line above, there is a unicode equence. In real, the line looks like:

'´╗┐sc create "Daenet.IntegrationService.%1" binPath= "%2" …

To work around this issue simly enter an empty row on the begining:

 

HERE IS THE EMPTY ROW
sc create "Daenet.IntegrationService.%1" binPath= "%2"


Posted Mar 26 2015, 06:55 AM by Damir Dobric
developers.de is a .Net Community Blog powered by daenet GmbH.