private void frmMain_Load(object sender, EventArgs e) { string vplocation; string defaultvp = Application.StartupPath + "default.vp1"; if (File.Exists(defaultvp)){ //if our default.vp1 exists, continue loading it vplocation = defaultvp; } else { //check if there is a arg[0] specified if (argparams.Length > 1) { if (File.Exists(Application.StartupPath + argparams[1])) { vplocation = Application.StartupPath + argparams[1]; //Environment.CurrentDirectory } else { //we couldnt find a default.vp1 or the file specified with args in our app.startuppath //last resort, check if the full path is specified if (File.Exists(argparams[1])) { vplocation = argparams[1]; } else { //we cant find the vp scriptfile or there isnt any specified. vpScriptnotfound(); } } } else { //we cant find the vp scriptfile or there isnt any specified. vpScriptnotfound(); } } }