1

I need to copy from %USERPROFILE%\Desktop to B:\Desktop where B is a mapped network drive. The code inside BAT file is:

powercfg -change -standby-timeout-ac 0
robocopy "C:\USER\DESKTOP\" "B:\DESKTOP"
powercfg -change -standby-timeout-ac 1
shutdown /s -t 0

In line 1, I want that windows never suspend, turn off, go to screensaver... Just stay awake. Then run robocopy, I'm using "/XJ /E /Z /R:5 /W:1" in the BAT that actually work. Line 3 is to set that win7 can do whatever it wants, just to not stay awake. Then it turn off the computer.

That's what i get:

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy para Windows

-------------------------------------------------------------------------------

  Iniciado: Tue Jan 27 15:17:08 2015

2015/01/27 15:17:08 ERRO 3 (0x00000003) Obtendo Tipo de Sistema de Arquivos do D
estino B:\TESTE\
O sistema não pode encontrar o caminho especificado.

   Origem : C:\USER\DESKTOP\
     Dest - B:\DESKTOP\

    Arquivos: *.*

  Opções: *.* /COPY:DAT /R:1000000 /W:30

------------------------------------------------------------------------------

2015/01/27 15:17:08 ERRO 3 (0x00000003) Criando Diretório de Destino B:\TESTE\
O sistema não pode encontrar o caminho especificado.

It IS in portugues, but the message is the classic error 3 one.

If I run as Admin, wich is necessarily to use powercfg, the robocopy will not run. If I run as user, robocopy run normally but I cant use powercfg.

What to do?

1
  • Just tried, my colleague is Admin on server. She created a folder using Admin account and yet it does not worked as expected. Jan 27, 2015 at 17:48

1 Answer 1

2

Re-establish B: mapping:

powercfg -change -standby-timeout-ac 0
if not exist B:\desktop\nul net use B: \\ComputerName\ShareName /PERSISTENT:No
robocopy "C:\USER\DESKTOP\" "B:\DESKTOP"
powercfg -change -standby-timeout-ac 1
shutdown /s -t 0

or, with different test:

powercfg -change -standby-timeout-ac 0
net use b:
if %errorleve% NEQ 0 net use B: \\ComputerName\ShareName /PERSISTENT:No
robocopy "C:\USER\DESKTOP\" "B:\DESKTOP"
powercfg -change -standby-timeout-ac 1
shutdown /s -t 0
2
  • That worked, Thanks <br>I cant set to pc never turn off now Jan 28, 2015 at 10:22
  • I re-worked on that and I got exactly what I want. A hint for those who wish to do something similar: nothing that is written on my question "code" actually work. Feb 5, 2015 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .