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 2 years ago.
Improve this question
I have a DAT file that I need to rename and make a txt file. It currently is named PRV4W.SW and I want it to be PRV4WSW.txt. I've tried below but it does not seem to work. Thanks.
ren "C:\PRV 4\20200731\PRV4W.SW" "C:\PRV 4\20200731\PRV4WSW.txt"
ren "C:\PRV 4\20200731\PRV4W.SW.dat" "C:\PRV 4\20200731\PRV4WSW.txt"
Please try
ren "C:\PRV 4\20200731\PRV4W.SW" PRV4WSW.txt
The above command works fine in Win7.
BTW, the new name should not contain [drive:][path]
Please type
help ren
for the usage of the ren command.
Related
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.
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 make a batch file which first creates a couple files, and then opens it
For one file I did
Set txt = (some text) """" & (some more text)
And then it puts that text into a .txt file but, everything after the & doesn't get copied. Only the things in front of it.
I would want to copy the whole thing, not only the things in front of the &
Put carret ^ just before the ampersand & character, it need to be escaped because it have special meaning in windows shell scripting
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 2 years ago.
Improve this question
When I try to run
netsh -c interface ipv4 add neighbors “Wi-Fi” “192.168.1.1” “00-24-36-A0-A0-61” store=persistent
in a bat file, it comes out as
netsh -c interface ipv4 add neighbors ΓÇ£Wi-FiΓÇ¥ ΓÇ£192.168.1.1ΓÇ¥ ΓÇ£00-24-36-A0-A0-61ΓÇ¥
store=persistent
in cmd. What can I do to fix this so they show up as regular quotation marks?
note: I am just learning bat so if there is something really easy to spot that I'm completely missing, that's why.
For me, it looks like, you are using "Unicode"-Quotations copied out from Microsoft Word.
Copy them into Notepad and replace them by real Quotations '"'.
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 2 years ago.
Improve this question
I try to make a map giving some values, but when I run the command the .bat processing is exited.
This is the snippet of my code:
choice /c k >nul
if %errorlevel%==1 goto mchk
:mchk
if %mn%=10 goto playerlevel
:playerlevel
cls
echo test
pause
Instead of going to playerlevel, the console window gets simply closed.
if %mn%=10 goto playerlevel
Should be
if %mn%==10 goto playerlevel
= is not a valid comparison operator, so your code generates a syntax error and aborts processing. When you use the point-click-and-giggle method of executing a batch, the batch window will often close if a syntax-error is found. You should instead open a 'command prompt' and run your batch from there so that the window remains open and any error message will be displayed.
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 2 years ago.
Improve this question
What is wrong with this code? it is supposed to print hello world
#echo off
set message = Hello World
echo %message%
I wrote it in notepad, and I saved it as first.bat, but when I run it in cmd.exe, it tells me echo is off
Do not add extra space before the equal sign in the set command.
#echo off
set message=Hello World
echo %message%