|
-
Hammerhead Shark
Batch file commands needed!
Hi,
Well I caught a thread in here with regards to making batch files to automate certain tasks. I'm inept with programming; even in DOS commands. What I'm trying to do is make a batch file that opens up dos prompt and upon execution it will show ipconfig (for one example).
So far I've:
file.bat
(%SystemRoot%\system32\cmd.exe"-.exe ipconfig /all)
() denotes contents of .bat file
This to me seems to be working, except it will only show it instantenously then close off again. It's like typing ipconfig in the RUN command which will quickly pop up the command prompt then shut down.
Help?
Thanks
-
put in another line below that simply saying 'pause' that waits until u hit enter or whatever
plus the command you are entering is to run a command prompt, a batch file IS a command prompt, there for all you need is to have a file called say "ip.bat" then two lines in it saying
ipconfig /all
pause
-
Super Bunny Mod
all you need in the batch file is
Code:
ipconfig /all
pause
the pause will cause the window to stay open by pausing, when you hit enter the script will continue and since there is nothing else to do it closes
[edit]beat by a few minutes
If your sig is longer than your post then type more.
-
Hammerhead Shark
Hahahaha! Thanks guys! 
Do you have any ideas/suggestions on what else one could use batch 'programming' to make windows cool ? this is really cool.
Thanks again!
-
I've been using a batch file for about a month now to automatically backup any new files in a certain directory from one computer to another. Here are the contents of this batch file:
Code:
@ECHO OFF
ECHO Backing Up System Files >>mp3log.txt
datestamp
ECHO =================================================== >>mp3log.txt
XCOPY F:\MCS_Files\Audio_Files C:\Backup /E /V /H /R /K /Y /D /C /I >>mp3log.txt
ECHO =================================================== >>mp3log.txt
ECHO Backup Completed >>mp3log.txt
ECHO - >>mp3log.txt
CLS
This batchfile also creates a log of what files have been copied. I also created a simple C program to date stamp the log file (since win98 won't do it thru DOS commands )
The ECHO command writes the text to the file after the >> sign. Also putting the >> sign and file name after commands writes the info that would have been displayed on screen into the file.
XCOPY and the switches after copy new files and files that have been updated (newer) from one directory to another (in this case from F: to C: )
The batch file is run nightly via the scheduling agent built into windows.
This is the only use I found for a batch so far in my daily computing adventures... tho I'm always on the look out for more
Last edited by Handyman; 04-13-2003 at 02:21 AM.
| Processor | Intel Pentium 4 @ 2800 MHz | Motherboard | ABIT IC7-Max3 | Memory | 2 GB Corsair XMS PC3200 DDR | Graphics | ATI Radeon 9800 Pro | OS/Prog HDD | W.D. Raptor 36GB (10k) SATA | Storage HDD | Seagate 160GB (7200) SATA | Burner | Lite-On 52x24x52 CDRW | DVD-ROM | Lite-On 16x DVD | Sound Card | Philips Acoustic Edge | Speakers | Klipsch ProMedia 2.1 | Flash Media | Lian-Li Flash Media Bay | Display | Dual NEC 22" Flat CRT | Case/PSU | Lian-Li PC-65B w/ Antec 430W | O.S. | MS Windows XP Pro | Printer | Epson Stylus Photo 2200
-
Why your MP3s are important enough to backup, I do not know! Anyway I have a lot of stuff I need to backup so I made some changes to your batchfile:
Code:
@ECHO OFF
REM Change NETDIR to include the network path you want your backups stored in
set NETDIR=X:\Backups
ECHO Backing up %1 to %NETDIR% >>backups.log
date /t >> backups.log
time /t >> backups.log
echo +++>> backups.log
ECHO =================================================== >>backups.log
XCOPY %1 %NETDIR% /S /V /H /R /K /Y /C /I >>backups.log
ECHO =================================================== >>backups.log
ECHO Backup Completed >>backups.log
ECHO +++ >>backups.log
ECHO. >>backups.log
ECHO. >>backups.log
echo Backed up %1 to %NETDIR%
Only one problem...it won't copy the directory to the backup dir, just all the files in it. Anyone know how to fix that? /S is supposed to copy all directories and subdirs.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|