WyattCollins
Member
- Local time
- 12:27 PM
- Posts
- 21
- OS
- Windows 11 Home 64-bit ver=22H2 build=22621.1702
I'm working on a script and need a little help with it.
Please critique and make suggestion's to improve the script and what it does.
I would like "one-liner's" where possible.
Look's like it need's some 'tidy-up'.
The script is meant to be manually ran under the C:\Users directory.
It delete's unneeded file's from the source directories.
Move's needed file's to a destination directory.
Append's a file extension to each needed file.
Delete's empty subdirectories from the source directory.
Retain's the source and destination directories.
Can I keep this script in a Desktop folder?
Does this script need an upper level cmd prompt for it to work?
Which is better for a user level script such as this, *.bat or *.cmd?
When I first ran this script, I ran it from C:\Windows\System32.
Cmd (Admin) threw error's, question's and info messages at me.
These were such like...
I read on the internet that the "::" is another way of writing "rem".
The only info about the "::" statement that the the author of that tutorial was specific about is that whatever is behind rem and :: is ignored.
Is that true or are there some thing's going on such as what the help page seem's to suggest about rem?
The
say's
If so, what and where is that file and how would I prevent commands from being endlessly recorded?
The script...
Please critique and make suggestion's to improve the script and what it does.
I would like "one-liner's" where possible.
Look's like it need's some 'tidy-up'.
The script is meant to be manually ran under the C:\Users directory.
It delete's unneeded file's from the source directories.
Move's needed file's to a destination directory.
Append's a file extension to each needed file.
Delete's empty subdirectories from the source directory.
Retain's the source and destination directories.
Can I keep this script in a Desktop folder?
Does this script need an upper level cmd prompt for it to work?
Which is better for a user level script such as this, *.bat or *.cmd?
When I first ran this script, I ran it from C:\Windows\System32.
Cmd (Admin) threw error's, question's and info messages at me.
These were such like...
"... [source directory, Are you sure? [Y] or [N]"
"Cannot specify the system"
What would I append into the script to have cmd echo the line number and phrase within that line which cause's these message's?"...Access is Denied"
I read on the internet that the "::" is another way of writing "rem".
The only info about the "::" statement that the the author of that tutorial was specific about is that whatever is behind rem and :: is ignored.
Is that true or are there some thing's going on such as what the help page seem's to suggest about rem?
The
Code:
help rem
Does it mean that line's beginning with rem is recorded in a file somewhere on the machine?Records comments (remarks) in a batch file or CONFIG.SYS.
REM [comment]
If so, what and where is that file and how would I prevent commands from being endlessly recorded?
The script...
Code:
@echo off
rem Delete unneeded files from source
del /s /q /a:- product*
del C:\Wyatt\Desktop\Test-Dir\5d\8d\product191_5d8d4c8a48e6e57c6b6af733e58923c2
del C:\Wyatt\Desktop\Test-Dir\dd\a8\product10968_dda8f69897aaa227624eb10e438512ee
del C:\Wyatt\Desktop\Test-Dir\f8\0b\product3205724_f80b9c604e691456970cf41d41aeee31
:: Move and rename files from source subdirectories and give the extension *.png to each file
move /y C:\Users\Wyatt\Desktop\Test-Dir\0b\8b\0b8bca5651664e27a343fb71586eb7f7 C:\Users\Wyatt\Desktop\Test-Dir\0b8bca5651664e27a343fb71586eb7f7.png
move /y C:\Users\Wyatt\Desktop\Test-Dir\3b\49\3b491db53fce5f9e48ffd1b4ea8f01eb C:\Users\Wyatt\Desktop\Test-Dir\3b491db53fce5f9e48ffd1b4ea8f01eb.png
move /y C:\Users\Wyatt\Desktop\Test-Dir\6a\50\6a50af3f8a6682a27083da35675f6ec5 C:\Users\Wyatt\Desktop\Test-Dir\6a50af3f8a6682a27083da35675f6ec5.png
:: Remove subdirectories from source
rmdir /s /q C:\Users\Wyatt\Desktop\Test-Dir\*
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\5d\8d
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\5d
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\dd\a8
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\dd
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\f8\0b
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\f8
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\0b\8b
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\0b
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\3b\49
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\3b
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\6a\50
rd /s /q C:\Users\Wyatt\Desktop\Test-Dir\6a
My Computer
System One
-
- OS
- Windows 11 Home 64-bit ver=22H2 build=22621.1702
- Computer type
- Laptop
- Manufacturer/Model
- HP 15-ef1105nr
- CPU
- AMD Athlon™ Silver 3050U
- Motherboard
- HP 8706 99.43 AMD Ryzen SOC rev. 00/FCH rev. 51 PCI-Express 3.0 (8.0 GT/s)
- Memory
- 4 GB DDR4-2400 MHz RAM (1 x 4 GB)
- Graphics Card(s)
- HP AMD Radeon™ Graphics 400MHz GFX core
- Sound Card
- AMD/Realtek HD Audio Device
- Monitor(s) Displays
- 15.6" HD LED (220 nits)
- Screen Resolution
- 1366 x 768
- Hard Drives
- 128 GB SATA 3 TLC M.2 SSD
- PSU
- 45 W Smart AC power adapter; 3-cell, 41 Wh Li-ion
- Keyboard
- HPQ Standard PS/2
- Mouse
- ELAN touchpad; Logitech Wireless
- Internet Speed
- 2.4 GHz/144 Mbps Realtek RTL8822CE 802.11ac PCIe Adapter
- Browser
- Google Chrome Version 115.0.5790.171 (Official Build) (64-bit)
- Antivirus
- McAfee LiveSafe™ (may get replaced with something more efficient)
- Other Info
- No optical drive; DirectX 12; HP True Vision 720p HD Webcam; BIOS: AMD AGESA PicassoPI-FP5 1.0.0.E UEFI; CCleaner; Glary Utilities; Speccy; CPU-Z; GPU-Z