0

I am not advanced with Windows.h header file. How do I make this work? When I use full directory path with my local user's name it works, but when I use %appdata%, it doesn't. I need to have %appdata% here for portability.

#include <stdio.h>
#include <Windows.h>

int main() {
ShellExecuteA(0,0, "%%appdata%%\\Roaming\\Zoom\\bin\\Zoom.exe","--url=zoommtg://zoom.us/join?action=join&confno=SECRET&pwd=SECRET",0,0);
}

"SECRET" is intentional, on actual usage they would be replaced with appropriate codes. Sorry for adding 'c++' tag for this question, but perhaps someone who knows how to solve this, could help me as well.

  • I don't remember if `ShellExecute` expands or not environment variables in its arguments (use `ExpandEnvironmentStrings` if not). Either case won't work if you double the `%` characters as in your snippet – MatG May 29 '21 at 11:14
  • @MatG How am I supposed to use `ExpandEnvironmentStrings` here though? ShellExecute indeed seems not to expand environment variables. –  May 29 '21 at 11:30
  • I'm not sure if you substituted `%%appdata%%` with `%appdata%`. Regarding `ExpandEnvironmentStrings` you can find a lot of examples – MatG May 29 '21 at 12:39

0 Answers0