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

Batch script to get file size

$
0
0

Hi,

I have the following script below to get the size of a Powerpoint template on a local path and send the size to a log (txt file) on a server share. The script works fine if run locally from the computer the script is on (it sends the file size to the share/file mentioned). But I'm trying to get it to run via a scheduled task using a Group Policy Preference for all users. Unfortunately it doesn't return the file size, it just returns "file size is  ". I'm assuming the problem might be that the scheduled task that is set up from Group Policy is run with a domain service account and it cannot find the local path of the powerpoint template file.

Does anybody know if there's any way round this?

call :getFilesize C:\Users\%username%\AppData\Roaming\Microsoft\Templates\Blank.potx
echo file size is %fileSize% >> "\\servername\share\%COMPUTERNAME%.txt"
exit /b

:getFilesize
set filesize=%~z1
exit /b


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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