how create a .bat file that deletes a file on remote server?
I am pretty new to .bat file concept. I have this daily admin task to remotely login on a server and delete the log file. I created a delete.bat
file which deletes the desired log file but it works only when it is located locally on that server. If I use the same code (del D:\Logs1\Logs2\a.txt /p
) on my local machine and schedule (using at 13:22 \\abc.xyz.com /every:m,t,w,th,f,s,su delete.开发者_开发技巧bat
) to run on remote server, it gives me an error that "the network path was not found".
I searched various websites but couldn't find anything, and if I find something, it's highly VB or some other programming language based solution which I don't understand much.
Any help would be great and thank you in advance.
you could try to map that path to a drive (of course you require Write privilege) and delete the files from that drive path.
to add network location (from command line) use: net use x: \\hostname\folder1\folder2
here x: can be replaced with any available drive letter.
精彩评论