windows - Create file for every script instance -


i've created script below obtain folder size of c:\users linux tool du. script distributed via gpo users.

xcopy \\0.0.0.0\netlogon\gnu-core-utils\du.exe c:\profile-size-script\ /i /s /y xcopy \\0.0.0.0\netlogon\gnu-core-utils\libintl3.dll c:\profile-size-script\ /i /s /y xcopy \\0.0.0.0\netlogon\gnu-core-utils\libiconv2.dll c:\profile-size-script\ /i /s /y c: cd c:\profile-size-script du -hs c:\users\* > \\0.0.0.0\userfolder\%username%.txt 

lines explained below:

  1. copies file called du.exe location c:\profile-size-script
  2. copies file called libintl3.dll same location.
  3. copies file called libiconv2.dll
  4. change drive c: in case cmd starts @ different drive letter.
  5. change same folder size
  6. use du folder size , echo output \0.0.0.0\userfolder\%username%.txt.

the issue script not creating new file each user appending firstly created file %username%.txt

i think you're looking this:

xcopy \\0.0.0.0\netlogon\gnu-core-utils\du.exe c:\profile-size-script\ /i /s /y xcopy \\0.0.0.0\netlogon\gnu-core-utils\libintl3.dll c:\profile-size-script\ /i /s /y xcopy \\0.0.0.0\netlogon\gnu-core-utils\libiconv2.dll c:\profile-size-script\ /i /s /y cd /d c:\profile-size-script /d %%u in (c:\users\*) (du -hs c:\users\* > \\0.0.0.0\userfolder\%u%.txt) 

the for /d loop reads through each of folders , executes du.exe command each folder (%%u) finds. check out for /? more information , other possibilities.

additional note: cd /d command allows change drive letter , directory @ same time. alternately, can skip c: , cd lines altogether if run commands without changing directory using explicit path this:

xcopy... /d %%u in (c:\users\*) (     c:\profile-size-script\du.exe -hs c:\users\* > \\0.0.0.0\userfolder\%u%.txt) 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -