You could use this in a .bat or .cmd file to do so. CLS will clear the screen in the command prompt. Pause will leave the command prompt open until you press a key to close it.
Code:
cd "[COLOR=red][B]full path of directory[/B][/COLOR]"
CLS
[B][COLOR=red]your command[/COLOR][/B]
pause
Hope this helps,
Shawn
My Computer
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
The adb app does not require the cd line and you might like pause better than ping... or not.
Code:
echo off
cls
C:\android-sdk-windows\platform-tools\adb.exe devices
pause
...detect a usb drive via batch file?
Are you wanting this batch file to run all of the time? ...always watching for a usb drive?
Will it always be the same usb drive that this batch file is looking for?
Ok i got it. I made this yesterday and it is quite complicated...
I will post the batch later for viewing purposes.
How would i make a batch file to ask the user for his username,drive lettrs etc. Then it would make a backup of the above file.it would then modify certain lines in the above files and replace them with the inputed username etc
My Computer
Computer Manufacturer/Model Number
Packard Bell iMedia 2218 -- Has Been Running For Almost 7 Years!
Helping you might be simpler if you would detail what your plans are. I can only assume that you want to copy files from a usb stick to a user's "my doc..." area.
You could also just use the variable %username% which will return the name of the person currently logged on.
Code:
echo off
echo %username%
pause
Be aware that people can change their username.
I can be logged on as Fred and my files are under C:\Users\Bob\...
The variable %username% will return Fred...
...but you might want Bob for the path info.
You might find this code more useful:
Code:
echo off
echo %homepath%
pause
Also be aware that some usernames have spaces in them:
C:\Users\Tony the Tiger\...
Which means that you should put quotation marks around the path even if you don't need them for most users.
i am trying to make a batch file to backup all the files on my phone to my documents - i have finished this bit, tested and all is working
i want to publicate this batch so everyone can use it.That means making a 'setup.cmd' that will edit the actual backup batch to suit the users needs. the %username% command you suggested will be used to determin the actual username, but i need a way for the user to specify where his internal sdcard and external sdcard are and adjusting the file accordinly. i will upload the file so you can view it
Attachments
Android File Backup.bat
2.6 KB
· Views: 8
My Computer
Computer Manufacturer/Model Number
Packard Bell iMedia 2218 -- Has Been Running For Almost 7 Years!
Ok i done it now and will publish tomorow. I am on my phone so i havnt got the file here.this is my first batch i make and it turned out to be 3500+words so i started big.now my phone is safely backed up. I still need a way to access the system folder for complete backup
My Computer
Computer Manufacturer/Model Number
Packard Bell iMedia 2218 -- Has Been Running For Almost 7 Years!
'sleep' is not recognized as an internal or external command, operable program or batch file.
I would use %homepath% instead of %username%.
Using dates for the folders is good - but I would create a path more like:
...\year\month\day-time
or
...\year-month-day-time
Those folder structures will sort better.
I do not want to discourage you from learning/using command line batch files, but if you are going to be giving this to others, you might want to learn a scripting language like AutoHotKey or AutoIt.
Thank you. I got the sleep command from windows resource kit tools which i found is a must.my batch will check for its existance and let you continue the backup if you have it and launch the installer if it isnt found.i have to ask what ste those extra tools for.....i have some understanding of LUA is it possible to run lua commands from cmd
My Computer
Computer Manufacturer/Model Number
Packard Bell iMedia 2218 -- Has Been Running For Almost 7 Years!
download the 2 files
rename batch to .cmd (this is only because sevenfroums wont let me upload .cmd files
put the 2 files in one folder
run the cmd file (previously batch)
how woudl i do the day-month-year-time thing?
My Computer
Computer Manufacturer/Model Number
Packard Bell iMedia 2218 -- Has Been Running For Almost 7 Years!
If you use a scripting tool like AutoIt (or AutoHotKey) you can write a script to do what you want without the user dealing with a command line interface.
For instance - your script can start when Windows starts and run all of the time (always watching for the phone to be connected). Once the phone connects, a tray tip (balloon) could popup reminding the user to backup the phone's files.... prompting the user to press a certain key combo to start the backup process.
LUA is not normally used as part of an AutoIt script. You don't need to know anything about LUA to use AutoIt. LUA is used by AutoIt devs to customize how the SCiTE editor supports writing and debugging the AutoIt code as you write/test your script. You don't have to use SCiTE - you can use Notepad to write scripting code if you want.
Again, I don't want to point you away from working with the command line interface (CLI) - too few people are learning that interface these days... but once you have things working as desired via CLI, consider recoding it using AutoIt or AutoHotKey to make your backup tool more user friendly.
ok, if i do stick with batch (which i might as learning a new language isnt exactly easy) Is there a program that can at least give it a gui so it looks a bit better?
My Computer
Computer Manufacturer/Model Number
Packard Bell iMedia 2218 -- Has Been Running For Almost 7 Years!