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"
Related
So, I'm programming a game, but the compiler I use is written as a Windows batch file. I'm using Windows 10 as my operating system.
In my game files, I have one folder with images, and another folder with upscaled versions of those images that have the same file name and extension.
What I want to do is have the batch file go through all the images in the directory with the upscaled images, and check if a file with the same name and extension exists in the directory with the original images. If it doesn't exist in the original directory, it will delete it from the upscaled directory.
I got it working using an answer over here:
Batch Extract path and filename from a variable
All I had to do was extract the file name and extension, and then run all the files in one folder through the loop, checking if the file exists in the other folder.
Here is my code:
for %%i in (%folder1%\*.png) DO (
if not exist "%folder2%\%%~nxi" ECHO %%~nxi
)
If you actually want to delete the files, change ECHO to del /q, be warned you will lose files, so make sure you have backups.
i'm a near complete beginner to batch scripting.
I'm currently learning how to create batch files. My goal is to compress a folder using exclusively InfoZip, add the date to the file name, and have that file copied to an USB memory stick plugged on H:\
The reason why i need to use InfoZip, even though it is a very old program, is because i need somthing that works even on Win95.
InfoZip is not installed, it is just unpacked in folder and ready to use.
It is possible to download InfoZip 3.0 from here:
https://sourceforge.net/projects/infozip/
Anyway, so far, the only thing i could come up with is this...
--------------------------------------
Title : Your folder will be zipped into an archive that will be copied on the USB memory stick plugged on your computer. Please DO NOT remove the memory stick during the operation.
#ECHO OFF
call d:\infozip\wiz.exe
pause
--------------------------------------
It just brings up the InfoZip window on the screen, but then i have absolutely no idea about how to make it zip a folder, add the date, and copy that zipped file to the USB.
All the regular commands meant for 7-zip or Winzip don't seem to work with InfoZip.
I could really use some help, please :)
Thanks!
Using the waybackmachine I was able to get the documentation for info-zip:
https://web.archive.org/web/20170829173722/http://www.info-zip.org/mans/zip.html#EXAMPLES
In contrary to what zip.exe shows, the syntax for zipping files is this:
zip -r zipfilename zipfilecontents
Example:
zip -r myzip.zip c:\myfolder\*.*
The -r parameter includes subfolders as well.
Problem is that the complete folder structure is included in the zip. I have not found a solution for this yet.
To solve the structure folder problem, add a cd command that will target the folder container which has inside your file or files. This before running the code proposed by Martien de Jong upside.
for example:
The path of my file is: cd C:\aa\B\file.txt
So the path you will put in the cd to target the folder container is: cd C:\aa\B
cd C:\aa\B
zip -r myzip.zip B\*.*
*Remember that this code will zip all the files included in B folder.
im working on a script that have few folders and i don't really understand how to make an config for this but i don't need it.
i have setup a script config inside
Set cfg=cfg2
Set txt=txt2
Set rar=rar2
cfg2, txt2, rar2 are in a diffrent directory
the files in cfg are cfg files but theres alot of them.
this also goes for txt & rar too.
i want a copy script that copies all cfg files (and only cfg files) into the cfg2 file that are in another directory.
and then this goes again for the txt & rar files.
I also know the code for move but i really want to copy it
cause on move you just do
move "txt/*.txt" %txt% and thats kinda what i want to do but that aint working
Have a look at robocopy from microsoft.
Something like the below should work;
robocopy /s \path\cfg \path\cfg2 *.cfg
How would i go about writing a .bat file, so that i can drag and drop a file onto it in windows 7, that would copy the file to the same directory, but on a different drive?
So if my file was:
D:\Files\Newfiles\File01.jpg
It would copy it to a prespecified network location (COMPUTER_01):
\\COMPUTER_01\Files\Newfiles\File01.jpg
I've looked into using command line parameters %~p1 and %~nx1, but i'm not sure how these would be implemented.
I'm sure this is painfully easy to do but I have no idea!
Painfully easy it is:
copy %1 "\\COMPUTER_01%~p1"
I have written a small batch file to move files from one folder to another folder.
copy E:\Source\Test.tif E:\Temp
Is there any way can I rename a file name after it has been moved to temp folder.Like
E:\Source:\TestInd1.tiff.
Please suggest.
You can do a move and a rename at the same time, yes:
move someFile S:\ome\Destination\newName