+(defvar mswindows-system-shells '("cmd" "cmd.exe" "command" "command.com"
+ "4nt" "4nt.exe" "4dos" "4dos.exe"
+ "ndos" "ndos.exe")
+ "List of strings recognized as Windows NT/9X system shells.
+These are shells with native semantics, e.g. they use `/c', not '-c',
+to pass a command in.")
+
+(defun mswindows-system-shell-p (shell-name)
+ (member (downcase (file-name-nondirectory shell-name))
+ mswindows-system-shells))
+
+(defun init-mswindows-at-startup ()
+ ;; shell-file-name is initialized in the C code (callproc.c) from
+ ;; SHELL or COMSPEC.
+ ;; #### If only shell-command-switch could be a function. But there
+ ;; is code littered around that uses it.
+ ;; #### Maybe we should set a symbol-value handler on `shell-file-name'
+ ;; that automatically sets shell-command-switch?
+ (if (mswindows-system-shell-p shell-file-name)
+ (setq shell-command-switch "/c")))
+