import ctypes, sys GetCommandLineW = ctypes.windll.kernel32.GetCommandLineW GetCommandLineW.restype = ctypes.c_wchar_p args = GetCommandLineW() numArgs = ctypes.c_int(0) CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW res = CommandLineToArgvW(args, ctypes.byref(numArgs)) args = (ctypes.c_wchar_p * numArgs.value).from_address(res) sys.argv = [] for arg in args[1:]: sys.argv.append(arg)