mystikal1000
asked on
Convert batch file to Powershell, need assistance
I have a batch file that copies IE favorites to their home drive. It searches a registry setting to find out where the favorites hold and then copies it to their Home Drive. I am new to PS, like to learn more, but need to get this one converted to Powershell or VBScript asap.
Thanks
Thanks
@echo off
setlocal
set NetworkFolder=h:\favorites
set FavoritesFolder=
for /f "tokens=2*" %%a in ('reg.exe query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Favorites" ^| find /i "Favorites"') do set FavoritesFolder=%%b
if "%FavoritesFolder%"=="" (
echo Could not determine the user's Favorites folder; exiting.
exit /b 1
)
echo User's Favorites folder: %FavoritesFolder%
echo Network folder: %NetworkFolder%
robocopy.exe "%FavoritesFolder%" "%NetworkFolder%" /e /r:0
if errorlevel 4 (
echo Error during copy; exiting.
exit /b 1
)
echo Successfully copied Favorites.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.