Is it possible to echo the echo command into a new file?

I'm trying to use a batch file to create another batch file ... this is a file that I should use quite often with a few variables changed each time. I ran into a problem because in the batch I am trying to create, it also uses an echo to write to the .txt file.

Here is the command:

echo echo %date% - %time% >> C:\MOVEit\Logs\FileGrabberLog.txt >> C:\filegrabber_%org%.bat

I want to enter a whole line echo %date% - %time% >> C:\MOVEit\Logs\FileGrabberLog.txtin C: \ filegrabber_% org% .bat.

I can put "around", but then they appear in the party I'm trying to create.

Does anyone know about this?

+5
source share
3 answers

% %% ^, ;

echo echo %%date%% - %%time%% ^>^> C:\MOVEit\Logs\FileGrabberLog.txt >> C:\filegrabber_%org%.bat
+5

, ,

setlocal EnableDelayedExpansion
(
  echo !="!echo %%date%% - %%time%% >> C:\MOVEit\Logs\FileGrabberLog.txt
) > C:\filegrabber_%org%.bat

.

, !="! , , .

!="! , =" ( ).

+1

:

, , , :

0

All Articles