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

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.

Quotations mark syntax in Windows Batch files [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
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 '"'.

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.

How to rename files using Windows command prompt with keeping first 6 characters and replace all others by fixed text? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a batch of PDF files in a folder and I am trying to rename them.
Example:
File1_20170501_data.pdf
File2_20170401_statistics.pdf
Sale2_20170404_Misc.pdf
I only want to keep the first six characters of each file name (the five characters left to underscore and the underscore) and replace everything behind with sample data.
The final file names should be:
File1_sample data.pdf
File2_sample data.pdf
Sale2_sample data.pdf
Anyone can advice which command line to use for this file renaming task?
Given your provided information at the time of this answer, one simple command should do what you need:
Ren "C:\path to\a folder\?????_*.pdf" "?????_sample data.pdf"

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