Hi,
I have a batch script, I am trying to call powershell command. It is giving me an error.
Below is the script:
set targetDBSize=
for /f %%G in (‘powershell “{0:N2}MB” -f ((gci -path \kalyantest\c$\Progra~1\Micros~1\MSSQL10_50.MSSQLSERVER\MSSQL\DATA%targetSite%.mdf | Measure-Object length -Sum).Sum/ 1mb’) do set /A targetDBSize=%%~zG
Can someone help me where I am doing wrong.
-Kalyan
Why do you want to use a batch script instead of a proper PowerShell script in the first place?
Hi,
The complete code was written in batch code. Trying to modify some part in that. While doing this, found an issue, I am not able get the file size which is having more than 2GB.
If I try to modify the entire code to powershell, it could create a mess.
So, wanted to use powershell command & then out the result to a file:
set targetDBSize=
do set /A targetDBSize=%%~zG
-Kalyan