Hello everybody,
I have the following problem:
I want to use the CMD from NAV to execute the SET HOMDRIVE function. The return value, i.e. the path, should be stored as a variable in NAV.
This is the code:
HomeDriveL := WshShell.Run('SET HOMEDRIVE');
HomeDriveL is a local variable and is from DataType a Text.
But when executing in NAV I get this error:
Error when calling System.__ComObject.Run with the following message: The system cannot find the specified file. (Exception of HRESULT: 0x80070002)
Can someone help me with that?
Many thanks in advance!
0
Answers
How you are using an Automation variable i gess that you have a 2009R2 NAV version or even lower, so you can try this:
Regards
thanks for your answer. When I use this function, there comes an error message, that this function is an outdated method.
Do you know whether there is a new one?
Thank you in advance,
Maxi
What NAV version do you have ?
Regards.
I have NAV 2013R2.
My problem is that I'm new to C/AL programming.
Thanks for your help.
You can use a DotNet variable to do that
Sorry this one
And use like this:
Another thing is that the DotNet variable must be run on client, otherwise it get you the environment var in the server,
So in the variable properties you must change the value like in the image:
Regards
Thank you for your help.
Now it works.
Ive made it with the DotNet variable and the property RunOnClient.