Eu estou tentando criar arquivos de log dinamicamente nomeados com base na data de hoje. Estou usando os exemplos encontrados na web, mas nenhum deles parece estar funcionando para mim.
C:\Users\Amit>echo hello > %date%.txt
The system cannot find the path specified.
C:\Users\Amit>echo hello > %date%.txt
The system cannot find the path specified.
C:\Users\Amit>echo hello > %date%.dat
The system cannot find the path specified.
C:\Users\Amit>echo hello > %date%.dat
The system cannot find the path specified.
C:\Users\Amit>echo hello > "%date%.dat"
The system cannot find the path specified.
C:\Users\Amit>echo hello > test.txt #this works
C:\Users\Amit>echo hello > %date%.txt
The system cannot find the path specified.
C:\Users\Amit>echo "testfile" >> backup-%DATE%.txt
The system cannot find the path specified.
C:\Users\Amit>echo "testfile" > backup-%DATE%.txt
The system cannot find the path specified.
Eu estou copiando e colando um monte deles também. estou a usar Windows 7 .
Eu não consigo descobrir qual erro eu estou cometendo.
Obrigado.
O que te faz pensar% date% busca a data fofa?
—
Ramhound
Hmm data bonito? Tenho certeza que ela é :) @Ramhound
—
DavidPostill
Você precisa definir
—
DavidPostill
date
primeiro antes de poder usar% date%. Veja minha resposta Lote do Windows, Configuração regional diferente, Renomear diretório YYYYmmDD_HHmmSS para uma maneira de obter uma cadeia de data e hora independente de localidade.
@DavidPostill Acho que consegui trabalhar agora, brincando com a string de data e extraindo parte por parte.
—
moondra
@DavidPostill: O que você quer dizer com
—
Axel Kemper
set date
? Como a data do Windows não pôde ser definida?