Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Environment.ExpandEnvironmentVariables not works with all variables

I noticed, that method Environment.ExpandEnvironmentVariables() does not returns values for some system variables such as %date%, %time%, %homeshare% etc... Why?

like image 888
Anatolii Humennyi Avatar asked Mar 23 '23 00:03

Anatolii Humennyi


1 Answers

%HOMESHARE% may simply be undefined (it's not defined in all situations). %DATE% and %TIME% are dynamic variables that AFAIK are not available outside of CMD (same goes for e.g. %CD% and %ERRORLEVEL%).

like image 143
Ansgar Wiechers Avatar answered Apr 06 '23 00:04

Ansgar Wiechers