How can copy and rename file in 1 time? - copy

How can i copy and rename a file like this.
From 'C:\Data\123456789_Sheet.dwg' to 'D:\Data\123456789.dwg'
Thanks

It's a task i should do in Win 10.
I just put the code in notepad en execute it with task scheduler.

Related

Batch file copy command partial name on file to directory

I have several files in a folder C:/Folder1 and I would like to create a batch file with copy or move command, to copy/move the files containing a partial number,12345, to C:/Folder2. The partial number it not at the beginning or end of the file name but in the middle.
I tried with wildcards but doesn't work.
Copy or Move ***.pdf C:/Folder2
Can anyone help please ?
Thanks,
Rui

Batch file to archive important files into a zip file in Windows 7

I have some files which I would like to be able to archive daily into a zip file that has the date in the filename.
The files to be archived are in one folder, let's call them a, b and c.
I would like them to be zipped into a file with the name archiveYYYYMMDD.zip into a second (different) folder where YYYYMMDD is the current date. I'm struggling to come up with a suitable batch file.
I'm running Windows 7 x64 Ultimate. I have a scheduling program which would run the batch file at a preset time every day.
Thanks
Alan
This can be done with shareware archiver WinRAR with a single command line:
"%ProgramFiles%\WinRAR\WinRAR.exe" a -afzip -agYYYYMMDD -cfg- -ed -ep1 -ibck -inul -m5 -r -y -- "Path to Backup Folder\Backup_.zip" "Path to Folder to Backup\"
This single command line can be executed directly as scheduled task. There is no need for a batch file.
The help of WinRAR opened by starting WinRAR and clicking in menu Help on menu item Help topics explains under Contents menu item Command line mode the command line syntax, the command a and the used switches.

How to launch multiple applications from a sed file

I have created a .sed file for input in iexpress.exe. The entry in .sed file has two applications. One is a batch file and another is an .exe file, for example:
AppLaunched=cmd.exe /c abc.bat
AppLaunched2=setup.exe
After creating the setup and executing, only the batch file is executed. I want to execute both files.
Any idea?
If I understand your problem correctly you could try using & to chain commands,
AppLaunched=cmd.exe /c abc.bat & setup.exe
There are a few other ways but this is one of the most simplistic.

Create a batch file to copy and rename file

I need to write a batch file that copies a file to a new folder and renames it.
At the moment, my batch file consists of only this command:
COPY ABC.PDF \\Documents
As you can see, it only copies the file ABC.pdf to the network folder Documents.
However I need to change this so it renames the file ABCxxx.pdf, where xxx is a text variable that I would like to set somewhere in the batch file.
For example, if xxx = _Draft, then file would be renamed ABC_Draft.pdf after it is copied.
Make a bat file with the following in it:
copy /y C:\temp\log1k.txt C:\temp\log1k_copied.txt
However, I think there are issues if there are spaces in your directory names. Notice this was copied to the same directory, but that doesn't matter. If you want to see how it runs, make another bat file that calls the first and outputs to a log:
C:\temp\test.bat > C:\temp\test.log
(assuming the first bat file was called test.bat and was located in that directory)
type C:\temp\test.bat>C:\temp\test.log

Reading/Capturing DOS input for use in MsBuild

How do I capture/read DOS input for use in MsBuild?
EDITED for clarification
Currently I have 2 files. One batch file, the other is the core.msbuild file which contains the msbuild stuff. I want to be able to capture an extra user input e.g. an output directory, from the windows command prompt (when the build file is executed) and send it to the msbuild file (and set it to a PropertyGroup). %1 is already taken so I'm thinking to use %2.
Like the following:
build.bat param1 param2
param2 is the one im trying to capture and do the above.
Thanks.
Got it...
In the build.bat file, append this to a build string:
... /p:customOutputDir="%1"
In MsBuild file:
<PropertyGroup>
<OutputDir>$(customOutputDir)</OutputDir>
</PropertyGroup>
Then OutputDir can be used in Targets.
Thanks.
Isn't the idea of an automated build that the build is repeateable and without user input?
But, i would guess that powershell has some better options for getting input from a user for this than standard dos.
Would it also be possible to query the user input before executing the build file and pass it as a param?