import ctypes, sys GetCommandLineW = ctypes.windll.kernel32.GetCommandLineW GetCommandLineW.restype = ctypes.c_wchar_p args = GetCommandLineW() numArgs = pointer(c_int(0)) CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW CommandLineToArgvW.argtypes = [c_wchar_p, c_void_p] CommandLineToArgvW.restype = ctypes.c_wchar_p sys.argv = CommandLineToArgvW(args, numArgs)