I doubt this will work: rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 .\RunOnceEx.inf You probably need to pass the correct path to RunOnceEx.inf, e.g. rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 D:\$OEM$\RunOnceEx.infYou wiill need to be sure that D is the CD drive (if hardcoded), or devise a way to have the correct CD Drive letter in a variable. Try first hardcoded, for easier debugging ...