1.

Solve : Create user defined directory and copy file to it?

Answer» HELLO,

I have the following case and would like to know if this can be solved using a batch file.

we have a lot of computers that are MOUNTED into trucks. EVERY now and then I would like to have a backup of the eventlog. But to save the eventlog into a specified directory the user needs to create a directory, with the registration number of the truck. Is it possible to have a batch file that can first ask the user wich name the directory needs and after that copy the eventlogs to the map with the name that has just been specified by the user?

REGARDS,
RonaldCode: [Select]@echo off
set /p Dir=Enter directory name:
:check
if exist \%Dir% goto blocked
md \%Dir%
::COPYING goes here

goto exit
:blocked
cls
set /p Dir=Directory already exists. Enter new directory name:
goto check
:exit
Ok, that asks for the directory name, then makes it at the root directory (most likely C:\, but you can change where it's going to be saved). It also checks if that directory is already made, and if so asks for a new name. The ::copying goes here is where your copy code goes. I don't know where your eventlogs are located, but just write:
Code: [Select]copy "your eventlog location" \%Dir%Hello Dark Blade,

Thanks for the answer. This is working perfect

Regards,
Ronald


Discussion

No Comment Found