2

I need to register an application to a URI scheme and I want the application to run from different working directory, but I couldn't find a way to change the working directory directly in shell open command without opening cmd. So my question is how to specify the working directory in shell open command? I tried @="cmd /k start /d v:\ c\:path\path\myapp.exe app.fmx user/password@database & exit" and it works but I want to do it without using the cmd

  • Did you try start "title" /D path/to/your/working/dir yourprogram.exe ? – Art Gertner Oct 9 '19 at 8:59
  • 1
    Start doesn't work in shell open command dont know why – X1y2 Oct 9 '19 at 9:37
  • 1
    @X1y2 because START is cmd.exe built-in command, not a separate executable. To use START, you must invoke «CMD /C "START "%title%" /D "%dir%" %command%"». Title may be empty, but then you'll still have to invoke start with empty quotes: «START "" /D "%dir%" %command%». Also notice there are surrounding quotes after /C around whole START command, they are mandatory, see cmd /? for /C syntax. However, you'll get blinking command line window as a side effect. – LogicDaemon Oct 9 '19 at 10:14
  • 1
    @X1y2 to get more comprehensive answer, and to ensure it's not an XY problem, please, add an example of specific URI scheme and command you want to invoke to the question. – LogicDaemon Oct 9 '19 at 10:15
  • I tried @="cmd /k start /d v:\\ c\\:path\\path\\myapp.exe app.fmx user/password@database & exit" and it works but I want to do it without using the cmd. – X1y2 Oct 10 '19 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.