duplicate file with different name and folder via batch - batch-file

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

Related

Tricentis Tosca - How to open a file which is the first file in a folder, or the only file in a folder. Note - I dont know the file name

The System Under Test generates some pdf files and saves the files to a particular folder. The challenge is that the pdf file name is randomly generated and I don't know the name. I need to open the file from the folder which is the most recent one, but I can't seem to find a way to open the file.
I know part of the file name so I tried using wildcard for part of the file name, but it doesn't work
I removed all other files from the folder and kept only one file in the folder, and then used wildcard instead of the complete file name, but that doesn't work either
Is there a way that I can read names of files present in a folder? Or open a pdf file using wildcard character? Or open the first file in the folder?
You could try PowerShell scripting (please refer attached screenshots)
Use the 'TBox Start Program' module.
In the Path attribute, mention the complete path of your PowerShell exe file (Eg: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)
In the Directory attribute, mention the folder path(Eg: C:\Users\tosca\Documents\testfolder)
Put -command in arguments with ActionMode 'Select'.
As Argument, input the PowerShell script with your wild carded file name to copy the file name (Eg:
(Get-ChildItem filename | Sort-Object CreationTime -Descending | Select-Object -First 1).Name | Clip)
Copy latest file name
Then use 'TBox Clipboard' to store the dynamic file name using ActionMode 'Verify'
Save latest file name
Then you can buffer the target file as folderpath\filename.

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

Batch copy folder-name to clipboard?

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

Batch File Copying

I am trying to copy a file from the C:\ drive to the steam directory using this
copy "C:\CSS.zip" "C:\%ProgramFiles86%\Steam\CSS.zip"
but it always makes a new folder and places the file in a new folder called %ProgramFiles86% but i want it to go in the actual Program Files (x86)
Thanks for the help
You aren't using the program files path correctly. Your code should be this:
copy C:\CSS.zip "%programfiles(x86)%\CSS.zip"

Bat file to compare files within folder A against folder B

Please can someone help with the below
I have two folders:
C:\FolderA
C:\FolderB
Folder A contains a bunch of files like an archive
Folder B contains the same bunch of files with the same name, however some data within the files may be different.
I want to write a .bat file which uses the diff command to compare all the files from folder A to the files in folder B with the corresponding name (e.g. update0001 against update 0001) and outputs the difference in "C:\Folder C" with each file difference in a separate text output. (e.g one file is called “Error update0001” and another “Error Update0005”
This is a simple way to check the files in two folders and give results.
fc /b "c:\folder a\*.*" "c:\folder b\*.*" >"c:\folder c\results.txt"

Resources