How to use tilde or space in includepdf filename?

Spaces at file names of PDF files at \includegraphics or \includepdf are allowed, if you are using package grffile:

\usepackage{grffile}
\usepackage{pdfpages}
% …
\includepdf[pages=-]{test this.pdf}

And for more verbatim interpretation of the file name you may use \detokenize:

\usepackage{grffile}
\usepackage{pdfpages}
% …
\includepdf[pages=-]{\detokenize{test~this.pdf}}

About the tilde: Apparently the ~ is taken in its usually meaning, not as literal ~. I get a Package pdfpages Error: Cannot find file `test\nobreakspace {}it' error for a test~it file. Taking the filename verbatim should help. This can be done by \Verbdef from the newverbs package:

\usepackage{newverbs}

% ...

\Verbdef\filename{C:/Users/MYUSER~1/AppData/Local/Temp/mypdfpdf.pdf}
\includepdf[pages=-]{\filename}

It is also possible to write \string~ instead of ~ every time. You shouldn't use math symbols to "escape" these characters in filenames. Typesetting and file reading are two completely different things.

Finally you can use the e-TeX primitive \detokenize{...} to sanitize the file name:

\includepdf[pages=-]{\detokenize{C:/Users/MYUSER~1/AppData/Local/Temp/mypdfpdf.pdf}}

To allow spaces you need to wrap the filename in " ". At best you should avoid any spaces, tildes or any other special characters in filenames.