• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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