Quotations mark syntax in Windows Batch files [closed] - batch-file

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 '"'.

Related

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.

Batch making text file input not copied [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 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

Simple batch script does not print variable as intended [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 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%

rename DAT file using bat command [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 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.

Rename a file in unix to include $ sign (ie a java class file) [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a java class file that is causing problems because of the length of the name:
GroundTransportationProductType$GroundTransportationOptions$GroundTransportationProductOption$GroundTransportationOptionProviderLinks$ProviderLinks.class
I have managed to get the file on the unix box (Solaris) by under a shortend file name.
my.class
How can I rename my.class to the correct class name above?
Using mv and cp normally (ie not doing something for the dollar signs) does not work.
I have googled and searched extensively but cannot find anything on how to create a file with a dollar name in it on unix.
Thanks,
Kenny
$ has a special meaning in shells, so you need to escape it somehow. The best option would be to use single quotes around your filenames. A \ in front of the '$' sign would also work.
mv my.class 'Long$File$Name.class'
or
mv my.class Long\$File\$Name.class

Resources