Closed DoS007 closed 6 months ago
Relating working directory: This may be the relating line . So the important line to change is here:
startInfo.WorkingDirectory = Path.GetDirectoryName(command);
. This should be set to the working directory of vdesk itself.
Could you change that? I would test the result then with my test.bat
above.
Now working directory of the process will be set to the current directory of vdesk. this also fix relative path. And i have added your script to my testscript folder.
VDesk started programs should behave in regard of workings directory like started without vdesk:
"Normal" Behavior
For testing I have a small
basedir\testdir\test.bat
file which i run in a cmd inbasedir\
contains:This means:
(Source: Stackoverflow)
When I run above file in cmd without vdesk no matter if i run relative (
.\testdir\test.bat
) or absolute ("C:\...\basedir\testdir\test.bat"
- exact path not copied here for privacy), I get:Current vdesk behavior
Now starting the batch in the same
basedir\
via vdesk:vdesk run -o 1 "C:\...\basedir\testdir\test.bat"
(absolute - exakt path not copied here for privacy).Relative running does not work (they all can not find the file):
vdesk run -o 1 ".\testdir\test.bat"
orvdesk run -o 1 .\testdir\test.bat
orvdesk run -o 1 "./testdir/test.bat"
orvdesk run -o 1 ./testdir/test.bat
Side note: Didn't list the PATH variable, but they seem to be the same.
Conclusion
The current working directory differs. So set the current working directory correctly.
This could be important for some programs and i had a problem where this could be the root cause (starting npx on a project).
And not so important: Allow relative path running.
Importance assessment
The first is important to fix, the second would just be nice but isn't essential.
And as always, thanks for your continuation of vdesk 😊.