Code: Select all
REM *********************Delete the Cache and Log Folders************************************************************************
set "servername=10.47.36.90"
set "psexec=E:\Jenkins_Software\PSTools\PsExec.exe"
set "Adminlogpathtofolder=\\%servername%\C$\narayana\Enviromnet_Setup\WIServerSetup\UAT\EDrive\Oracle\Middleware\user_projects\domains\Skandia\servers\AdminServer\logs\"
%psexec% \\%servername% pushd "%Adminlogpathtofolder%" && (rd /s /q "%Adminlogpathtofolder%" 2>nul & popd)
if %errorlevel%==0 goto cachedeletesuccess
if NOT %errorlevel%==0 goto cachedeleteunsuccess
:cachedeletesuccess
set "cache_delete_status=success"
echo "Cache Deletion Successfully"
goto exit
:cachedeleteunsuccess
set "cache_delete_status=failure"
echo "Unable to delete the cache"
goto :EOF
:exit
Below is the error I got when I run my above batch script
Code: Select all
C:\Users\SVCT-WI-Jenkins\Desktop>REM *********************Delete the Cache and Log Folders************************************************************
************
C:\Users\SVCT-WI-Jenkins\Desktop>set "servername=10.47.36.90"
C:\Users\SVCT-WI-Jenkins\Desktop>set "psexec=E:\Jenkins_Software\PSTools\PsExec.exe"
C:\Users\SVCT-WI-Jenkins\Desktop>set "Adminlogpathtofolder=\\10.47.36.90\C$\narayana\Enviromnet_Setup\WIServerSetup\UAT\EDrive\Oracle\Middleware\user_
projects\domains\Skandia\servers\AdminServer\logs\"
C:\Users\SVCT-WI-Jenkins\Desktop>E:\Jenkins_Software\PSTools\PsExec.exe \\10.47.36.90 pushd "\\10.47.36.90\C$\narayana\Enviromnet_Setup\WIServerSetup\
UAT\EDrive\Oracle\Middleware\user_projects\domains\Skandia\servers\AdminServer\logs\" && (rd /s /q "\\10.47.36.90\C$\narayana\Enviromnet_Setup\WISer
verSetup\UAT\EDrive\Oracle\Middleware\user_projects\domains\Skandia\servers\AdminServer\logs\" 2>nul & popd)
PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
PsExec could not start pushd on 10.47.36.90:
The system cannot find the file specified.
C:\Users\SVCT-WI-Jenkins\Desktop>if 2 == 0 goto cachedeletesuccess
C:\Users\SVCT-WI-Jenkins\Desktop>if NOT 2 == 0 goto cachedeleteunsuccess
C:\Users\SVCT-WI-Jenkins\Desktop>set "cache_delete_status=failure"
C:\Users\SVCT-WI-Jenkins\Desktop>echo "Unable to delete the cache"
"Unable to delete the cache"
C:\Users\SVCT-WI-Jenkins\Desktop>goto :EOF
Can anyone help me on this...