Batch copy folder-name to clipboard? - batch-file

Is it possible to copy the first sub-folder-name in a main-folder to clipboard and set this sub-folder-name for a .jpg ?
Example:
C:\Users\Admin\main-folder
sub-Folder-name1
subFolder-name2
subFolder-name3
I want that everytime the batch run only the name of the first sub-folder get copied (sub-Folder1) and set this name for a .jpg in another folder with an additional name.
Example Output:
sub-Folder-name1 + _GranCanaria +.jpg
the file will then be called at the end sub-Folder-name1_GranCanaria.jpg

Related

How to rename PDFtk-server files with timestamp?

I am using PDFtk-server to merge 2 PDF files. This creates a new PDF with name Test_.
Now, what I am looking for is a batch files that renames the Test_ files to Test_datestamp and then move them into another folder and delete the files.
It is working if only one file is present.
pdftk C:\test\*.pdf C:\test\file-to-add\file.pdf cat output C:\test\output\Test_.pdf
ren "C:\test\output\*pdf" "Test_ - %date:/=.% %time::=-%.pdf"
del C:\test\*.pdf
Then comes to copy part to other folders.
If having multiple files, the first one gets renamed but other not, because it is trying to set the same timestamp, so I need some kind of delay between renaming.

batch file variable to store file paths

I have multiple files with .arxml present inside a sub folder. I want to store the file paths in a variable and later this variable is used by a java command.
Folder1 inside this subfolders are present so my .arxml file can be present in any of the subfolders.
In a batch file I want to store in a variable all these file.arxml path names separated by a comma and this variable is used by a Java command.
Java command is present in same batch file.
Example
#echo start
Variable = c:/abc/h/f1.arxml , c:/efg/f2.arxml ....etc
Java command -winputs = variable
#Echo we are back

How to look at the contents of a zipped folder in batch?

In this case, I have a zip folder with contents inside. How would I look into the zip folder and be able to check the file name of those files for a certain word without having to unzip the file to begin with?
So for example:
I have a zip folder with the files inside named
123456789COW.txt
123445614COW.txt
123456789ASK.txt
232436787CAT.txt
and I want to check if the file has COW inside the name.
Every solution I have found so far has assumed I know the contents already, but in my case that may not always be true and I need to check.

batchfile : copy active selection

Mean: I want to add a batch file to the right click property.
Action that this file needs to do is to go to a folder and look up the highlighted/selected text that I've selected when clicking on the batch file.
My question is how to get this highlighted text selected into a variable in the batch file?
Later on I can use this variable in the code to navigate to the folder and select the correct file.
I'll use following code then:
#echo off
start wgnplot.exe "c:\path to file to open\VARIABLE.pdf"

duplicate file with different name and folder via batch

I want to copy a file to a user defined folder with different filename via batch file
Here folder path is supplied by argument
CODE
type abc > %1\\my_abc
but it does nothing than creating file in same folder
whats my mistake?
Why don't you use :
copy abc %1\my_abc

Resources