whenever I try to launch M-x term from my Windows distribution of GNU Emacs, I get the error:
apply: Spawning child process: invalid argument
This is an attempt to record a more general answer about the message "Spawning child process: invalid argument", which emacs produces in various situations. I am using emacs 25.0.50.1 on Windows 7, but I have looked into this before with earlier versions and I do not think that anything relevant has changed. For some reason, this error does not start the debugger even if debug-on-error is set. However, it seems that the error is always generated by the function start-process in subr.el (in the top lisp directory). You can therefore enter M-x debug-on-entry RET start-process RET, and then do whatever it is that caused the error. Emacs will then show a backtrace buffer, the second line of which will show the arguments passed to start-process. The last argument is supposed to be the name of an executable file. In all cases where I have seen the "Spawning child process: invalid argument" error, the executable file did not actually exist. You then need to work out where emacs got the filename from, and how to change it. You can get some clues from the rest of the backtrace buffer.
In the case of the M-x term command, the executable file used is the first of the following things that has a non-nil value:
explicit-shell-file-name (which you can customize after entering C-h v RET explicit-shell-file-name RET)ESHELLSHELL/bin/sh(You can see this by looking at the code in term.el in the top lisp directory.)