Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 372 Vote(s) - 3.64 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is it possible to echo an echo command into a new file?

#1
I'm trying to use a batch file to create another batch file... it's a file I have to use quite often with a few variables changed each time. I'm running into an issue because in the batch I'm trying to create, it is also using echo to write to a .txt file.

Here is the command:

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

I want to enter the whole string `echo %date% - %time% >> C:\MOVEit\Logs\FileGrabberLog.txt` into C:\filegrabber_%org%.bat.

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

Anyone know of a way around this?
Reply

#2
You escape `%` with `%%` and other special characters with `^` so this should work;

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

#3
Or to avoid the carets you can use *disappearing quotes*

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

Only the percents have to be doubled then.

It works, as the `!="!` is parsed in the special character phase, and it is decided, that the rest of the line will be quoted.

And in the delayed phase the `!="!` will be removed, as the variable with the name `="` does not exist (and it can't be created).
Reply

#4
The following answer might be beneficial to your question:

This was posted earlier and the answer was given, similar to what was given here:
[Ignore Percent Sign in Batch File][1]


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through