Options

Multiple environment variables as a filename?

/usr/usr Member Posts: 1,768
Is there a way to do this? When I try two, it tends to complain and wants to use one.

I want something like %USERNAME%&(machine name)

Anyone know if there is an environment variable to grab the machine name?

Comments

  • Options
    RussSRussS Member Posts: 2,068 ■■■□□□□□□□
    In what context is that?

    If you are in a Netware environment the machine is called the domain. With XP there are a few registry hacks needed to create a single sign-on - is that what you are trying to achieve?
    www.supercross.com
    FIM website of the year 2007
  • Options
    WebmasterWebmaster Admin Posts: 10,292 Admin
    Type set in the command prompt to list the current variables. COMPUTERNAME is one of them. Try this to combine two:

    set NewVar=%username%\%Computername%

    and then type set again and check if NewVar is listed with the correct value.
  • Options
    ajs1976ajs1976 Member Posts: 1,945 ■■■■□□□□□□
    %computername%

    To put both together use %username%%computername%

    from a command promt I typed "dir > c:\%username%%computername%" and it created the text outfile with the name usernamecomputername.
    Andy

    2020 Goals: 0 of 2 courses complete, 0 of 2 exams complete
  • Options
    WebmasterWebmaster Admin Posts: 10,292 Admin
    Yes indeed. I was using that \ because I assumed you wanted it for logon purposes and turned around the username and computername icon_bounce.gif It's purpose is not to combine the two vars.
  • Options
    /usr/usr Member Posts: 1,768
    Windows 2000 doesn't allow remote backups of the system state using ntbackup. I haven't been able to find a workaround so far.

    I'm writing a small batch file to send to the end users, which will back up their system state and send it to a network drive. I need the environment variable for the names of the backup.

    I was originally using the account name, but some machines use the same account, so I'm going to use the machine name as well in order to distinguish between the two.

    Thanks for the %computername% information. I didn't think to try that and I couldn't find a list anywhere.
Sign In or Register to comment.