Saving DOS command to a txt file [closed] - batch-file

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I need to save list of DOS commands itself in a text file.
But when I am using
echo copy source_file target_file >> new_command.txt
it is writing the copy command to the file correctly but at the same time it is executing the command.
What I want is that this should only write the copy command to the file without executing it..
new_command.txt should contain
echo copy source_file target_file

I don't know why you want to do this though :)
echo echo copy source_file target_file >> new_command.txt

Related

.bat file for launching Jupyterlab with julia [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I always type the commands below on CMD to launch jupyterlab:
[cmd]
julia
using IJulia
jupyterlab()
I wanted to automate this process and I tried writing a .bat file test.bat and running it on CMD:
[test.bat]
echo "launching jupyterlab..."
julia
using IJulia
jupyterlab()
end
However, CMD stops reading the commands after reading the command julia at 2nd line, meaning, it doesn't run using IJulia and jupyterlab().
What is going on and what should I do?
Any information would be appreciated.
Try using julia in evaluate mode like this:
julia -e "using IJulia; jupyterlab()"

How to write a batch script to call a .exe file? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I have a .exe file (let's say it's name is XXX.exe) whose job is to clean a text file with all lines starting with %. Usually I call the .exe file in CMD as:XXX.exe clean_text.dat and it does the job.
However I want to create a batch file where the text file's name will be user input and rest everything will be done automatically. I have written a script as:
#echo off
set /p file= Enter filename:
XXX.exe file
After giving the filename (with full path), CMD flashes error saying it can't access to the input file.
I believe the last line is not correctly writtten. Can anyone provide the solution?
Use %file% in the last line. You want the contents of variable file and not the name of the variable to be used as parameter for program XXX.exe.

i am having batch file but it gives syntax error when using in windows 7 [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
# echo off
move /y c:\program files (x86)\presst~1\Newsview\received\coreplus \\edt_np\pti
#echo off
d:\sleep 30
d:\wire.bat
You need to "quote parameters containing separators"
move /y "c:\program files (x86)\presst~1\Newsview\received\coreplus" \\edt_np\pti
Just had a rough look:
Seems like you need to use some " for your paths. A space leads the programm to think that the next argument start but your arguments are not c:\program and files and (x86) etc. Instead it is one string "c:\program files (x86)\presst~1\Newsview\received\coreplus"

how to remove the batch file you just used [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do I remove a batch file I just used with a batch code line?
Like a code that does this:
remove thisbat.bat
Thanks in advance.
Some people will tell you to just put
DEL "%~f0"
on the last line, but that usually causes an error in that the BAT file can no longer find itself. You should use the following statement on the last line of your BAT file, because after it hits this line your BAT file is gone:
start /b "" cmd /c del "%~f0"&exit /b
This will launch a new delete process within the same console, thus eliminating any "file can no longer be found" errors.

windows scripting to search a value in '.HL7' file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Through windows batch file, I am trying to -
a. open a folder > open latest '.hl7. file (by date) in the folder.
b. search a specific value in the file. e.g value of the key 'name'
c. echo the value.
I am new to scripting, Can anybody help me write a script for the same?
I am not sure about the format of the HL7 files but this will get the most latest HL7 file into env variable MyFile and then print the lines in the file that have "name" in them.
#set MyFile=
#for /F %%I in ('dir /od /b *.hl7') do set MyFile=%%I
#if defined MyFile find "name" %MyFile%
If HL7 has many different formats you may be better off writing a program that uses an HL7 library to parse your file.
I hope this helps you get started.

Resources