       app.quit() if process.platform is 'win32'
 
     app.on 'will-quit', =>
-      fs.unlinkSync socketPath if fs.existsSync(socketPath) # Clean the socket file when quit normally.
+      # Clean the socket file when quit normally.
+      if process.platform isnt 'win32' and fs.existsSync(socketPath)
+        fs.unlinkSync socketPath
 
     app.on 'open-file', (event, pathToOpen) =>
       event.preventDefault()

  # the other launches will just pass their information to this server and then
  # close immediately.
  listenForArgumentsFromNewProcess: ->
    fs.unlinkSync socketPath if fs.existsSync(socketPath)
    server = net.createServer (connection) =>
      connection.on 'data', (data) =>
        @openWithOptions(JSON.parse(data))

    # take a few seconds to trigger 'error' event, it could be a bug of node
    # or atom-shell, before it's fixed we check the existence of socketPath to
    # speedup startup.
    if (process.platform isnt 'win32' and not fs.existsSync socketPath) or options.test
      createAtomApplication()
      return

