Good morning,
i would like to start automatically a robocopy from the CD if the CD is in the device.
The goal is, that the .bat command starts as soon as the user has put in the CD.
Enclose the .bat file which needs to be completed:
************************************************************
@ echo off
start cmd.exe
robocopy D:\ C:\Users\Ladina\Desktop\Test /E /LOG:C:\Users\Ladina\Desktop\Test\log.txt
************************************************************
Thank you for your help!
Regards
Ladinai
How to start a .bat file automatically if a CD is in the device
Moderator: DosItHelp
Re: How to start a .bat file automatically if a CD is in the device
if you don't have access to the machine you are aiming you should check this - https://msdn.microsoft.com/en-us/librar ... 02(v=vs.85).aspx
if it is your own machine you can create a schedule task triggered by event .You have to check the event log for the event written when cd is put. here's shctasks help - http://ss64.com/nt/schtasks.html
if it is your own machine you can create a schedule task triggered by event .You have to check the event log for the event written when cd is put. here's shctasks help - http://ss64.com/nt/schtasks.html
Re: How to start a .bat file automatically if a CD is in the device
Hello,
thank you. This seems to be a bit too complicated. Yes it is my own device so I do have full admin acces.
Is there no simple if-clause like if CD is in device D: than run .bat file..?
Thank you and best regards
Ladina
thank you. This seems to be a bit too complicated. Yes it is my own device so I do have full admin acces.
Is there no simple if-clause like if CD is in device D: than run .bat file..?
Thank you and best regards
Ladina
Re: How to start a .bat file automatically if a CD is in the device
ladinai wrote:Hello,
thank you. This seems to be a bit too complicated. Yes it is my own device so I do have full admin acces.
Is there no simple if-clause like if CD is in device D: than run .bat file..?
Thank you and best regards
Ladina
Well we can check if there is something in the D: drive but the batch file would constantly have to run and keep checking for the existence. Batch files are not really event driven by themselves.
Re: How to start a .bat file automatically if a CD is in the device
Hey,
alright I see. So there it's might be better to do this point through the windows services...
However I do have another question als well.
I would like to enhance my code:
*******************************************************************************
@ echo off
start cmd.exe
robocopy D:\ C:\Users\Ladina\Desktop\Test /E /LOG:C:\Users\Ladina\Desktop\Test\log.txt /V
*******************************************************************************
The goald is that I will be asked at first to create a new share. I would like to be asked: please enter a new folder name.
Than I will enter for example "TEST1" and this folder will automatically build under the path specified: (for example) D:\ C:\Users\Ladina\Desktop
Than, secondly after I have created this new folder, the code should start with this part:
robocopy D:\ C:\Users\Ladina\Desktop\Test1 /E /LOG:C:\Users\Ladina\Desktop\Test1\log.txt /V
Important will be, that it already takes into concern the new entered folder name where the dates will be stored in.
Can you help me with that? I think for me it is at the moment far too complicated. However it would be a very useful thing since there is a lot of storage work to do.
alright I see. So there it's might be better to do this point through the windows services...
However I do have another question als well.
I would like to enhance my code:
*******************************************************************************
@ echo off
start cmd.exe
robocopy D:\ C:\Users\Ladina\Desktop\Test /E /LOG:C:\Users\Ladina\Desktop\Test\log.txt /V
*******************************************************************************
The goald is that I will be asked at first to create a new share. I would like to be asked: please enter a new folder name.
Than I will enter for example "TEST1" and this folder will automatically build under the path specified: (for example) D:\ C:\Users\Ladina\Desktop
Than, secondly after I have created this new folder, the code should start with this part:
robocopy D:\ C:\Users\Ladina\Desktop\Test1 /E /LOG:C:\Users\Ladina\Desktop\Test1\log.txt /V
Important will be, that it already takes into concern the new entered folder name where the dates will be stored in.
Can you help me with that? I think for me it is at the moment far too complicated. However it would be a very useful thing since there is a lot of storage work to do.