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?
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
User contributions licensed under CC BY-SA 3.0