I couldn't get the Windows %OneDrive% environment variable to work in a Run cmd.
Perhaps it's not currently supported. This FR is to recommend support be added for the OneDrive environment variable.
Regarding 'Are you sure %onedrive% is set in the context that pwsafe is running?' How do I verify if it is or not? I do see the correct substitution for %onedrive% if I type SET in a CMD window.
The Password Safe run cmd I'm using launches another windows application that takes command line arguments and one of my command line arguments has the %onedrive% in it, which is a path to an input file.
I cut and pasted the run cmd I used in Password Safe with %onedrive% in it into a Windows system Run window and everything worked as expected. However, when Password Safe run cmd is used the windows application is launched, but the command line argument with %onedrive% in it is not substituted (you can tell since the launched application shows the path it is using for the command line argument with %onedrive% in it and it ends up being a non-existent path)
For this particular case, replacing %onedrive% in the Password Safe run cmd with the correct substitution works, so if you want to close this ticket, that's okay with me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What I did was just type in a dummy command, say, "echo", with the variable, and then checked the error message.
For example, with the run command
echo homedrive=%HOMEDRIVE% OneDrive=%OneDrive%
I get an error message with the variables expanded:
Windows cannot find 'echo homedrive=C: OneDrive=C:\Users...'.
This shows that the expansion (substitution) is correct.
Perhaps there are spaces in the path that require placing the path in quotes?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for trying to help. I tried your example and got the same result you did. I also tried placing the path in quotes but that also did not solve the issue. The issue is probably caused by the application my run cmd launches. I can get by with not using the %onedrive% environment variable, but I'll try some other ideas before giving up.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Odd. All %env_var% substitution for the run command is done by Windows.
Are you sure %OneDrive% is set in the context that pwsafe is running?
Hi Rony,
Regarding 'Are you sure %onedrive% is set in the context that pwsafe is running?' How do I verify if it is or not? I do see the correct substitution for %onedrive% if I type SET in a CMD window.
The Password Safe run cmd I'm using launches another windows application that takes command line arguments and one of my command line arguments has the %onedrive% in it, which is a path to an input file.
I cut and pasted the run cmd I used in Password Safe with %onedrive% in it into a Windows system Run window and everything worked as expected. However, when Password Safe run cmd is used the windows application is launched, but the command line argument with %onedrive% in it is not substituted (you can tell since the launched application shows the path it is using for the command line argument with %onedrive% in it and it ends up being a non-existent path)
For this particular case, replacing %onedrive% in the Password Safe run cmd with the correct substitution works, so if you want to close this ticket, that's okay with me.
What I did was just type in a dummy command, say, "echo", with the variable, and then checked the error message.
For example, with the run command
echo homedrive=%HOMEDRIVE% OneDrive=%OneDrive%
I get an error message with the variables expanded:
Windows cannot find 'echo homedrive=C: OneDrive=C:\Users...'.
This shows that the expansion (substitution) is correct.
Perhaps there are spaces in the path that require placing the path in quotes?
Hi Rony,
Thanks for trying to help. I tried your example and got the same result you did. I also tried placing the path in quotes but that also did not solve the issue. The issue is probably caused by the application my run cmd launches. I can get by with not using the %onedrive% environment variable, but I'll try some other ideas before giving up.