r/Batch
list file size but brief unexpected BH change when in a script
the following line does what i want
for %A in (*.zip) do @echo %~fA - %~zA Bytes
but when i add it to a batch .bat file i instead get
The following usage of the path operator in batch-parameter
substitution is invalid: %~zA Bytes
For valid formats type CALL /? or FOR /?
The syntax of the command is incorrect.
while when typed in I get
C:\MeteorRepos\remoteapitesting>for %A in (*.zip) do @echo %~fA - %~zA Bytes
C:\MeteorRepos\remoteapitesting\ethernetspeed.zip - 769203 Bytes
Before someone tells me all about and lectures me on X Y theory I''l explain the X or the Y whatever order The goal: I've just got a 10 lines batch script that start
setlocal ENABLEDELAYEDEXPANSION
Which runs a compiler, a few steps in python, and creates (from scratch) a large zip file from a temp folder and then deletes the folder. It's literally 10 lines. At the end it would be very slick if all I had was a line that prints the size of the zip file. Any hints what's borked in my very n00b interpretation of the runes for DOS, this is the first ever DOS loop I've written that was not straight-up copy-pasta.
Copying all user files onto a usb drive
Hey im very new to batch and everything coding
I need to copy every file from the user path onto my usb drive.
I just need it to copy it and be fast.
If anyone can help me out that would be great
Batch Pong Revisited
https://github.com/IcarusLivesHF/Batch-Pong
Features
I've been working on this for a while, and at this point it's gotten a little ridiculous for a .bat file.
Gameplay
- 400 × 100 character playfield
- First to X mode
- Timed mode
- 1 player vs CPU
- 2 player local multiplayer
- CPU can be replaced with a second human player
- CPU difficulty slider
- CPU difficulty affects lookahead, reaction time, paddle speed, miss chance, and aim error
- CPU rubber-banding based on the score difference
- Two-point lead required to win in First to X
- Deuce cap so matches can't go on forever
- Configurable timed matches
- Longest rally tracking
- Rally counter displayed during matches
- Rally record displayed on the end screen
- Best scores saved separately by difficulty and time limit
Ball physics
- Fixed-point integer physics
- Four decimal places of sub-cell precision
- Ball speed is independent of frame rate
- Paddle position affects return angle
- Paddle movement affects the return through spin
- Edge hits produce additional boost
- Spin and edge boost decay over time
- Rally length permanently increases the minimum ball speed
- Swept collision detection so fast balls don't just phase through paddles
- Integer sine/cosine table for angle calculations
- Ball trajectory is constrained so it can't become perfectly vertical
Visual stuff
- ANSI/VT rendering
- Ball trail
- Seven-cell fading trail
- Particle effects
- Dynamic score/HUD
- Animated menu
- Studio intro/logo
- Intro can be disabled
- Attract/demo mode after sitting in the menu
- Credits screen
- Statistics screen
- Mouse-driven UI
- Sliders and toggle controls
- Console automatically configures itself for the game
Audio
- Background music
- Multiple music tracks
- Next-track control
- Music pause/resume
- Separate music and SFX volume
- Music mute toggle
- Sound effects for gameplay/UI
- SFX volume can be changed live
- Preloaded sound effects to avoid spawning a process every time something happens
- Audio runs separately from the main game loop
Controls
- W/S or arrow keys for movement
- Separate controls for both players
- Mouse support in the menus
- Toggle ball trail during a match
- Skip music tracks during a match
- Pause/resume
- Configurable music volume while playing
Progression / stats
- 29 achievements
- Achievement progress saved
- Achievement state stored as a bitmask
- Persistent statistics
- Best scores
- Longest rally records
- Records separated by difficulty/mode where appropriate
- Achievement/reward-style tracking for different things you do in matches
Other stuff
- Settings are saved between runs
- Nothing is installed
- Nothing runs at startup
- No internet connection required
- Runs entirely through Windows
cmd.exe - Forces the game into a properly configured console window
- Uses separate processes for input and audio
- Cleanup of temporary files/processes when the game exits
The entire game is written in Windows Batch.
No external game engines were used.
Overall, it runs great, and I am very happy with it. Enjoy!
Copy files into the appropriate folders
I have 71 directories named after a location in the US in the format "CITY_STATE" (ie "ALBANY_NY").
In each of these directories I have sub-directories reading 1mile, 3mile, 10mile, 30mile.
I need to sort through 284 image files named "CITY_STATE_image_SIZE.tif" (ie "ALBANY_NY_image_1m.tif") and copy them into the appropriate folder.