Todd W
asked on
Another VBSCRIPT Copy file request (with a twist)
I have a unique situation (I think)
I have a ton of Windows XP Pro machines floating around the network
I have a ton of Windows 7 machines floating around the network
Obviously the user profiles are in different locations depending on the OS installed.
I have a need to copy a single Excel file from an app server to the following directory on the machine depending on the OS.
Windows 7 machines - C:\Users\username\AppData\ Roaming\Mi crosoft\Ad dIns
Windows XP machines - C:\Documents and Settings\username\Applicat ion Data\Microsoft\AddIns
I've been fighting with how to determine the OS and copy the file to the correct location based on the OS version.
So basically, when the user logs in, the script runs, copies abc.xls file from \\appserver\sharename\ to either the Windows 7 user profile or the Windows XP profile
Can anyone help?
I have a ton of Windows XP Pro machines floating around the network
I have a ton of Windows 7 machines floating around the network
Obviously the user profiles are in different locations depending on the OS installed.
I have a need to copy a single Excel file from an app server to the following directory on the machine depending on the OS.
Windows 7 machines - C:\Users\username\AppData\
Windows XP machines - C:\Documents and Settings\username\Applicat
I've been fighting with how to determine the OS and copy the file to the correct location based on the OS version.
So basically, when the user logs in, the script runs, copies abc.xls file from \\appserver\sharename\ to either the Windows 7 user profile or the Windows XP profile
Can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or the APPDATA varialbe, as I used above....oops....
that script can help :
@echo off
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
echo %vers% | find "Windows 7" > nul
if %ERRORLEVEL% == 0 goto ver_7
goto notfound
:ver_7
xcopy \\appserver\sharename\abc. xls C:\Users\username\AppData\ Roaming\Mi crosoft\Ad dIns /d
goto exit
:ver_xp
xcopy \\appserver\sharename\abc. xls "C:\Documents and Settings\username\Applicat ion Data\Microsoft\AddIns" /d
goto exit
:notfound
echo Machine undetermined.
:exit
@echo off
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
echo %vers% | find "Windows 7" > nul
if %ERRORLEVEL% == 0 goto ver_7
goto notfound
:ver_7
xcopy \\appserver\sharename\abc.
goto exit
:ver_xp
xcopy \\appserver\sharename\abc.
goto exit
:notfound
echo Machine undetermined.
:exit
ASKER
Awesome!
Detailed and organized structure. More than I expected to receive
Thanks for your assistance
Detailed and organized structure. More than I expected to receive
Thanks for your assistance
Regards,
Rob.
Open in new window