{"id":99705,"date":"2018-09-12T07:00:00","date_gmt":"2018-09-12T21:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=99705"},"modified":"2019-03-13T00:29:48","modified_gmt":"2019-03-13T07:29:48","slug":"20180912-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20180912-00\/?p=99705","title":{"rendered":"How do I get the system to run my program in this very special way?"},"content":{"rendered":"<p>A customer registered their program to be run automatically under conditions not important to the story. They found, however, that the program didn&#8217;t work because the program was written with an application framework that looks for configuration files in the current directory, but the system wasn&#8217;t setting the current directory properly. They couldn&#8217;t change the directory in their program because the code that looks for the configuration file is in the framework, and it runs before any of their code does. <\/p>\n<p>Oh, and I forgot to mention that mention that the <a HREF=\"http:\/\/memory-alpha.wikia.com\/wiki\/Fizzbin\"><code>FIZZBIN<\/code><\/a> environment variable needs to be set to <code>KRONK<\/code>, except on Tuesdays, in which case it needs to be <code>SHRONK<\/code>. <a HREF=\"https:\/\/www.youtube.com\/watch?v=_DeIExLcURQ\">Except at night<\/a>. <\/p>\n<p>Okay, maybe the customer&#8217;s requirements weren&#8217;t that weird, but you get the idea. <\/p>\n<p>You can&#8217;t get the system to do all these things for you, but you don&#8217;t have to. <\/p>\n<p>Write a helper program and register the helper with the system. The helper program sets the current directory, sets the <code>FIZZBIN<\/code> environment variable, does all the fancy preliminary nonsense your precious program requires, and then launches the real program. <\/p>\n<p>Bingo, your current directory, environment variable, and favorite teddy bear are all set up waiting for you. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can set up the special way yourself.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-99705","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>You can set up the special way yourself.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/99705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=99705"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/99705\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=99705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=99705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=99705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}