The Water Cooler

Calling cmd type $U commands in Powershell

  • 1.  Calling cmd type $U commands in Powershell

    Posted 08-09-2019 07:16 AM
    (This post has also been posted in the $U Community, maybe the Water Cooler has a few ideas)

    ​​$U 6.9 Windows 2012 R2

    Wanting to expand the use of $U which has a default command (MS DOS) language into PS.  Commands that would have originally been done in a CL_INT type Uproc could now be done in PS.  Things like

    • %UXEXE%\uxlst task which would be in dos "%UXEXE%\uxlst" TSK EXP SES=* UPR=* MU=* FULL 

    This can be done from command window after loading the $U environment or in a CL type uproc which does the same by default.

    In PS window it is possible to load the $U environment using the following command with a '&' to prefix the string command.

    • &"C:\Program Files\AUTOMIC\DUAS\<node_name>\mgr\uxsetenv.bat"

    However when running Get-ChildItem ENV: in PS after the environment is loaded the $U variables do not evaluate. For example $UXEXE or $ENV:UXEXE so the above command cannot be translated into PS and does not evaluate, its as if the environment is loaded then all the variables are discarded.

    I suspect this is more a PS thing than $U, is there a way to do this as this would open the door to calling $U commands within PS scripts and PS type Uprocs.  Really just wanting to run 'old' dos commands within PS as the syntax is more familiar and not sure if there a PS equivalent to these commands yet in $U.

    If this can be done then can develop lots of Uproc and scripts in PS to do things like list tasks, launch other sessions or Uprocs etc

    What have I missed?​