7

I'm trying to write a batch file that can copy a file from my computer to all computers in a list. It needs to be copied to the AllUsers Desktop (I'll use a domain admin account to run the batch file).

On my Win7 system, the %ALLUSERSPROFILE% returns C:\ProgramData. Is there a variable that returns the AllUsers Desktop path across every version of Windows? I have a mix of XP, Vista, and Win7.

Chaddeus
  • 13,134
  • 29
  • 104
  • 162

4 Answers4

15

It is %public% in Windows 7...

akjoshi
  • 15,374
  • 13
  • 103
  • 121
Kyle P
  • 151
  • 1
  • 3
3

%public% works for Windows 10 and Windows 2011 Server and up

%ALLUSERSPROFILE% is used in Windows XP

But, you can look to see what the available variables are by running "SET" from a command prompt

2

There's no environment variable holding desktop path, but with this post you can see how to get it in batch (answers are for current user desktop, you'll need to adapt them for all users desktop

Community
  • 1
  • 1
CharlesB
  • 86,532
  • 28
  • 194
  • 218
1

in vista, 7, 8

%userprofile%\..\Default\Desktop