       fs.unlink dst, ->
       x.ext = '.bat'
       delete x.base
-      bat = yml[x.name] or yml[':*']
+
+      for q in dup [x.name, ':*'], debug
+        if bat = yml[q]
+          break
+
       fs.writeFile path.format(x), toANSI """
         #{prolog}#{word bat.command}"%~f0" #{word bat.args}#{target}
         #{yml[':epilog']}#{do z.source}

me::apply = (compiler)->
  compiler.plugin "done", (compilation)->
    yml = readYML()
    target = yml[":target#{if compilation.compilation.options.debug then ':debug' else ''}"]
    prolog = yml[':prolog'].replace '#{homepage}', ini.homepage

    for k, z of compilation.compilation.assets


toANSI = (s)->
  iconv.encode s, 'cp1251'

dup = (array, debug)->
  unless debug
    return array
  res = []
  for s in array
    res.push "#{s}:debug"
    res.push s
  res
