Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Forums > General Discussion

Vista - Collection of Batch files for everyone to use!

Reply
 
Old 4 Weeks Ago   #91 (permalink)


Vista Home Premium 32bit SP2
 
 

Re: Collection of Batch files for everyone to use!

Oh and I just remembered some other handy batch files I made.
When I used to use Hamachi (a VPN program), Vista sometimes would connect to my emulated Hamachi network card by default instead of my ethernet card and my internet wouldn't work until I went into devmgmt.msc and disabled Hamachi.

I solved this by making a batch file (hamachi.bat) to use devcon.exe to tell me of the status of my Hamachi network driver, and then give me the options to disable it, enable, start hamachi, or exit. Note: This script needs devcon.exe (from Microsoft) and grep.exe to run. grep is a very popular Unix command written to search for text in stdout and return any lines matching that text. Along that, you could specify flags, such as to invert the search, or be case insensitive. Since Windows doesn't have anything equivalent to it, I just download the Linux version compiled for Windows. It's commonly piped (|) from other commands and acts as a filter.

The second batch file gets rid of Windows' cache of all the updates you download (the installation files). I guess you should only use this if you want to free up some space. Note: it removes the history of the update being installed when you look at previously installed updates in Windows Update.

And here's a list I copied from some other website that I've found useful, basically it's variables that you can use in your batch files which can save you time and make your batch files more portable.
Code:
%ALLUSERSPROFILE%      C:\Documents and Settings\All Users
%APPDATA%     C:\Documents and Settings\{username}\Application Data
%COMPUTERNAME%     {computername}
%COMSPEC%     C:\Windows\System32\cmd.exe
%HOMEDRIVE%     C:
%HOMEPATH%     \Documents and Settings\{username}
%PATH%     C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem
%PATHEXT%     .COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH
%PROGRAMFILES%     Directory containing program files, usually C:\Program Files
%PROMPT%     Code for current command prompt format. Code is usually $P$G
%SYSTEMDRIVE%     The drive containing the Windows XP root directory, usually C:
%SYSTEMROOT%     The Windows XP root directory, usually C:\Windows
%TEMP% and %TMP%     C:\DOCUME~1\{username}\LOCALS~1\Temp
%USERNAME%     {username}
%USERPROFILE%     C:\Documents and Settings\{username}
%WINDIR%     C:\Windows

%DATE%     Current date in the format determined by the Date command
%TIME%     Current time in the format determined by the Time command
%CD%     Current directory with its full path
%ERRORLEVEL%     Number defining exit status of a previous command or program
%RANDOM%     Random number between 0 and 32767
To try them out, you could open up cmd and type 'echo %date%' or 'echo %userprofile%'.

Oh and if you think you'll be writing more batch scripts in time, I highly recommend downloading Notepad++ (I've linked the latest version from their SourceForge page). It has syntax highlighting for lots of popular programming and scripting languages, like batch, and it makes working with them a lot easier. And it's not much of a RAM-hog; I pretty much use it as a Notepad replacement.

Attached Files
File Type: bat Hamachi.bat (709 Bytes, 8 views)
File Type: bat purge update cache.bat (302 Bytes, 4 views)
My System SpecsSystem Spec
Old 4 Weeks Ago   #92 (permalink)


Ubuntu 9.10 64 Bit
 
 

Re: Collection of Batch files for everyone to use!

Thanks for the huge contribution

I almost stopped making them because there was nothing left to make. I had almost every program I could think of into one batch file with its own menus. But thanks for the ideas and help, greatly appreciated
My System SpecsSystem Spec
Old 1 Week Ago   #93 (permalink)


Ubuntu 9.10 64 Bit
 
 

Re: Collection of Batch files for everyone to use!

I can't remember who posted in here how to make a auto-run flash drive with my batch files on it. But I can post those files here with a how to [ courtesy of original poster of the information ] so people can plug in a flash drive and run those tools. Kind of a neat troubleshooting gadget.
My System SpecsSystem Spec
Old 1 Week Ago   #94 (permalink)


Ubuntu 9.10 64 Bit
 
 

Re: Collection of Batch files for everyone to use!

Now I'm going to do a small How-To on how to use the autorun feature of these batch files, or any batch file for that matter

- Plug in the flash drive you would like to use for autorun and tool use
-> Windows should find it and ask what you want to do...

- Select the Open Folder and View Files option
->If there are any files on the drive you are using, be sure to back them up

- Now go ahead after everything is backed up, delete everything from the flash drive.

- Place the batch file you want to use in the drive, not in a folder, just on the drive.
-> F:\Test.bat

- Now place the attached file to this post - autorun.inf - on the drive also
-> you will need to edit the autorun.inf to your information
-> the label is the name of the flash drive you plugged in - bobs drive
-> the shellexecute is the name of the batch file - make sure its correct

- Now safely remove the flash drive then plug it back in to the computer and it should run the batch file that you dropped on it.

- If it does not run, then safely remove it and plug it in again, you might need to set the auto-run option to run the disk contents. Not sure yet, maybe someone else can chime in on that...
Attached Files
File Type: zip autorun.inf.zip (235 Bytes, 2 views)
My System SpecsSystem Spec
Old 1 Week Ago   #95 (permalink)


VISTA home prem 32bit SP2 --- XP Pro SP3 32bit
 
 

Re: Collection of Batch files for everyone to use!

check this
Attached Files
File Type: exe Windows 7 in a Box.exe (280.0 KB, 6 views)
My System SpecsSystem Spec
Old 1 Week Ago   #96 (permalink)


Ubuntu 9.10 64 Bit
 
 

Re: Collection of Batch files for everyone to use!

Quote  Quote: Originally Posted by pacinitaly View Post
check this
Can't run that, I'm using linux...

Is a pendrive installation of Win7?
My System SpecsSystem Spec
Old 6 Days Ago   #97 (permalink)


Vista Home Premium x64 sp2
 
 

Re: Collection of Batch files for everyone to use!

Quote  Quote: Originally Posted by CrucialHoax View Post
Quote  Quote: Originally Posted by pacinitaly View Post
check this
Can't run that, I'm using linux...

Is a pendrive installation of Win7?

Thats exactly what i've been trying to do with x64 Vista. But I dont have an actual install dvd,just the recovery sent with the machine. Just wanted another option to boot from to save a crach. I actually stumbled upon a flash drive that is already partitioned with..get this..built in boot files! Google Kaser Flash dvd
My System SpecsSystem Spec
Old 6 Days Ago   #98 (permalink)


Vista Home Premium x64 sp2
 
 

Re: Collection of Batch files for everyone to use!

That is just too freaking cool Pacinitaly! You rock. Now...if I were to just drop that onto a flash, I could then boot my system from it,yes??
My System SpecsSystem Spec
Old 6 Days Ago   #99 (permalink)


Vista home premium 64 bit
 
 

Re: Collection of Batch files for everyone to use!

Quote  Quote: Originally Posted by roy69 View Post
Here is a copy of my experiment to autorun a webpage from a memory card.
Use it as an example of how to get a batch file running and how to get a web page running.

Attachment 15779
This was my previous post on the autorun subject

This has only been tested on Vista.
My System SpecsSystem Spec
Old 6 Days Ago   #100 (permalink)


Vista Home Premium x64 sp2
 
 

Re: Collection of Batch files for everyone to use!

Quote  Quote: Originally Posted by roy69 View Post
Quote  Quote: Originally Posted by roy69 View Post
Here is a copy of my experiment to autorun a webpage from a memory card.
Use it as an example of how to get a batch file running and how to get a web page running.

Attachment 15779
This was my previous post on the autorun subject

This has only been tested on Vista.

Cool Roy, thanks! Mind if I PM you. Have a quick question.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Sort files collection ? VB Script
Help with IF in batch files General Discussion
Batch files Vista file management
Batch Files Vista General
In Vista, can .wps files be converted to .rtf files as a batch i.e.instead of one at a time? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46