Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Unable to run batch script as Windows server 2008 R2 Scheduled Task using option "Run wheter user is logged in or not

$
0
0

Hi there,

I'm using Windows server 2008 R2 on one of my Pro Env, I have two batch files (See Block code)

Both should run when the user is logged off however only batch file number 1 is working

All setting are the same

any help will be great

P.S I'm straggling around this issue fora while

Please note the script contain access to a network drive p:\ and I think this is the issue I even try to include "net use" with user name and password in the script but no success.

May be I should use a different command like "remove item" in power shell

Batch 1:

set path="C:\Program Files\WinRAR\";%path%

cd D:\Xsense Services\Protocol\Logs

winrar a -df -ep -agDD-MMM-YYYY-NN Protocol_.rar -x*.txt

move *.rar \\xs-nas\Public\XS-App1\PP1

cd "D:\Xsense Services\ProtocolComm3\Logs"

winrar a -df -ep -agDD-MMM-YYYY-NN ProtocolComm3_.rar -x*.txt

move *.rar \\xs-nas\Public\XS-App1\PP3

cd "D:\Xsense Services\ProtocolZespri\Logs"

winrar a -df -ep -agDD-MMM-YYYY-NN ProtocolZespri_.rar -x*.txt

move *.rar \\xs-nas\Public\XS-App1\PP2

Exit

Batch 2

forfiles /p "P:\XS-App1\PP1" /s /m *.rar /c "cmd /c Del @path" -d -90
forfiles /p "P:\XS-App1\PP2" /s /m *.rar /c "cmd /c Del @path" /d -90
forfiles /p "P:\XS-App1\PP3" /s /m *.rar /c "cmd /c Del @path" /d -90
Exit



Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>