I wrote batch script that will write some variables to the text file located on netshare and create batch file based on some variables that will be created on workstation and run later.
How do I write to a text file on netshare so I have one file with entries from all of the machines instead of many separate files - one for each machine. Another words - when I run the script now - I get the the separate results file for each workstation or if I do not customize file name - I get the previous entries over written in that file - I would like to have all data in one file so I can easily import it into database.
The script I have so far is as follows:
cd \documents and settings\les
for /f "tokens=3" %%a in ('dir /-c/s ^| find "File(s)"') do set sizeofdir=%%a
rem Writing all info I need for this machine to results.txt located on netshare
echo Directory Size: %sizeofdir% Logon Server: %LOGONSERVER% Computer Name: %COMPUTERNAME% ^
User Name: %USERNAME% User Domain: %USERDOMAIN% User Profile: %USERPROFILE% > path to netshare\results.txt
rem Creating batch file on workstation that will run the copy
echo xcopy "C:\documents and settings\%USERNAME%" "C:\documents and settings\%USERNAME%.%COMPUTERNAME%" /s /e /h > c:\runcopy.bat