Easy task, windows prompt batch file - windows

I am a Windows 7 User who wants to convert multiple *.eps files to pdf-files. Therefore I installed a program called EPSPDF.rb.
I integrated it into my systempath which makes me use it in the command prompt like this:
C:\TEMP>epspdf somefile.eps
The program converts somefile.eps to somefile.pdf.
What I am trying to achieve now is writing a Windows Batch File which will look in
the directory C:\TEMP for all *.eps files and convert them all.
I am still trying hard since I am quite unfamiliar with the programming language.
I guess writing the few lines will be an easy issue for someone who is familiar with Batch Files in Windows. I will be very grateful for any help!

for %%f in (*.eps) do epspfd %%f
This is for use in a batch file. You can run it right on the command prompt, only you need to use %f instead of %%f. Just because. ;)

for %F in (*.eps) do epspdf %F

Related

Inkscape commandline convert list of files

I'm using a Windows batch script in Powershell to convert all numbered .svg files in a folder to .png, using Inkscape on the commandline, based on the answer to a previous question here.
#echo off
for %%i in ("%~dp0*.svg") do (
echo %%i to %%~ni.png
"C:\Program Files\Inkscape\bin\inkscape.com" --export-type="png" --export-background-opacity=1.0 "%%i"
)
The script calls Inkscape again for each file, which I suspect is the main speed bottleneck (I have many files to convert). I would prefer to call Inkscape once and provide the list of files to convert.
Is it possible to use --shell mode to do this? I cannot find an example that uses this approach.
One approach I found was to use the interactive --shell mode with a sequence of "actions" and "verbs" such as this:
inkscape --shell
> file-open:file001.svg;export-filename:file001.png;export-do; file-open:file002.svg;export-filename:file002.png;export-do;
You can generate a long list of these action and verb sequences, one for each file. It works very well, but unfortunately I wasn't able to paste a large enough text string for the thousands of SVG files I wanted to convert. I think Powershell is limited by the amount of text you can paste into it, as is the usual command prompt.
Therefore it would be great if a future version of Inkscape accepted batch file containing such a list of commands. Currently it doesn't seem possible, as far as I can tell from the documentation.
Following on from your own answer, I created a 10,000 line file called inkscape.cmd that looks like this:
inkscape-version
inkscape-version
inkscape-version
...
...
and ran it with:
inkscape --shell < inkscape.cmd
I have only tested this on macOS as I don't have Windows.

Change all file endings via batch

I need to change all file endings in one folder from .sic to .edi via a windows batch file. As I usually don't work with cmd or else (mostly doing html work...), I don't really know how to start this. I couldn't find an existing question matching my requirements either.
The following single line should do it!
Ren "YourFolderPath\*.sic" *.edi
Very simple:
ren *.sic *.edi
Just create a batch file with that line, or just go into Command Prompt and type it in manually.
This is one use case where Windows batch is easier than Linux shells.

copy exe file while it's running?

This following code in my bat file copy's the bat file while it's running into a correct directory in windows 7 but when I convert it to a exe script it no longer works.
Can any one suggest a alternative ? Or any suggestions to why?
if not exist "%programfiles%\toolset\" (
md "%programfiles%\toolset\"
copy "%~f0" "%programfiles%\toolset\"
)
can any one else help I'm pretty sure it's not my converter tool I use as I have tried all the ones listed below but I think the script needs editing for it to function as exe application?
You can try the following nice tool
http://www.battoexeconverter.com/
since you are accessing programfiles you need to be admin
To do this run the cmd in admin mode and try to execute in command line
Download this tool. It works well.
Bat2Exe
You can add administrator manifest to run as administrator when opening the exe file.
I am a batch programmer just like you.
Personally I use this tool;
http://www.f2ko.de/programs.php?lang=en&pid=ob2e
Nice tool, only requires a download, used it multiple times, never dissappointed me, and it is very legit, have no doubts about it!
Pringles

Making Any Command in CMD work in a .BAT as an .EXE

Redirecting CMD Commands To An EXE File
Long story short, basically I have the problem that every time I run BCDedit on the .BAT that I converted into an .EXE it never worked and I thought that the reason why it wasn't work was because it wasn't on Path but my Path was fine and even if it was on Path is set by default thanks to foxidrive.
Now my main problem is that is there a way I can convert it to an .EXE file with every single command working, is there a technique I could use to get BCDedit working as an .EXE file?
All of the commands do work it just BCDedit and I say if every single command would work so if somebody has a similar command problem like me they know how to figure it out, it works perfectly as batch but is there a way I can convert it and make BCDedit still work as an .EXE?
Please answer As Soon As Possible and if you want to take a look at my Path and Batch the visit the link at the top.
Thank you so much!
Compile this batch file and see if it works:
#echo off
bcdedit /?
pause
Then try this version:
#echo off
c:\Windows\System32\bcdedit.exe /?
pause
Just as the SysWow64 Redirection link you listed states. If you want a x86 application to call the 64-bit system directory you need to call the bcdedit application as follows.
%SystemRoot%\SysNative\bcdedit
This is because of Windows backwards compatibility measures, it is looking at C:\Windows\SysWOW64 instead of C:\Windows\System32. Another alternative would be to compile the script as both x86 and 64-bit, but then you could only use each on the respective systems.
Update for Comments
Even though the path is correct, an x86 application will execute commands or batch scripts against the C:\Windows\SysWOW64\cmd.exe which will cause the path redirection issue. Example to illustrate my point. On a 64-bit version of Windows, open C:\Windows\SysWOW64\cmd.exe and using Windows explorer create two unique files , one is C:\Windows\System32\unique_test64.txt and the other in C:\Windows\SysWOW64\unique_test86.txt. Now on the x86 command prompt enter if exist C:\Windows\System32\unique_test86.txt echo true. You will see that it is being redirected to SysWOW64 and will print true. And if you enter if exist C:\Windows\System32\unique_test64.txt echo true, nothing will be found.
Screenshot Example: http://i.imgur.com/K4kkI29.png

Listing the files inside a folder using batch file

I am using a batch file to view the contents (xml files) of a certain folder.
I need to use a batch file for it.
Found this command on internet and it is working perfectly when I type in the command prompt, but when I type it in and save as a batch file, it doesn't give any out put at all. (Basically not running the content)
FOR /R D:\Myfolder %F in (*.*) do rename %~nF.xml %~nf1.xml
There are no restrictions in the folder either.
Shouldn't have worked from the prompt.
In a batch file, you need to change any % for the metavariable (%F in this case) to %%.
Having said that however, (or, from the prompt, %F and %f) are two different animals. It's virtually the only situation where batch is case-sensitive. Your command attempts to rename files using their NAME only (~nF) so if it was to encounter fred.txt it would attempt to rename Fred.xml to -er, 1.xml (I think, maybe %~nf.xml)
Best to say what you're trying to do. We're reasonably slick at crufting up solutions...

Resources