• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

How to auto insert domain name into a command line?

Does anyone know how to insert a domain name into a command line for a script? Example: \\ServerName\Users\%UserName%\

I tried using %domainname% but is doesn't work.

I am trying to use universal scripts for DFS, Example: \\%domainname%\Public Share
0
infinitybs
Asked:
infinitybs
  • 2
1 Solution
 
Andrej PirmanCommented:
Into Command prompt type

SET

and it will list all available environent variables. You might find usefull some like these:
%USERDNSDOMAIN%
%USERDOMAIN%
0
 
infinitybsAuthor Commented:
This is what I was looking for, but it will not allow me to use %USERDNSDOMAIN% in folder redirection GPO. I am trying to redirect the My Docs folder to \\%USERDNSDOMAIN%\UserData$\. It works when I type it into run, but not when I insert it into root path under folder redirection. Do you know a way to get this to work?
0
 
OpytkCommented:
Is the domain going to change based upon the person?

So something like \\servername.domain\users\%username% does not work?
0
 
Andrej PirmanCommented:
Instead of putting it in under folder redirection, you can do it also by creating/modifying a startup script, which will do something you like. Batch script is run on user's computer and will recognise all environment variables.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now