1.

Solve : Backups batch file help.?

Answer»

I have a BATCH file that I used to zip Virtual machines up with (for backup).

I used to use the line below successfully for the other version:
for /F "usebackq tokens=1" %%i in (`cmd /c "vzcfgt get %1 GUID"`) do (
set vid=%%i)


The vzcfgt command returned a folder name. (This is for a virtuozzo server)

C:\>vzcfgt get 101 GUID
{4B6944CA-73D3-4E3B-80BA-215374548822}


That command no longer returns the folder name. I need to use vzbackup list %1 now.

C:\>vzbackup list 101
listing...

VPS 101
backup ID
66a9c707-8bdf-42e0-8cf0-2ab3777e7839/20080804202501
66a9c707-8bdf-42e0-8cf0-2ab3777e7839/20080805183923

My problem is that I don't know how to read just the first 'x' characters of the INPUT from the command. I've tried different THINGS that I've found on this site.

This is what I have right now:

for /F "usebackq tokens=1" %%i in (`cmd /c "vzbackup list %1"`) do (
set vid=%%i:~0,25)


Any help would be GREATLY appreciated.This might work:

Code: [Select]@echo off
setlocal enabledelayedexpansion
for /F "usebackq tokens=1" %%i in (`cmd /c "vzbackup list %1"`) do (
set vid=%%i
set vid=!vid:~0,25!
)



Discussion

No Comment Found