Showing posts with label tricks. Show all posts
Showing posts with label tricks. Show all posts

Tuesday, 12 June 2012

Tips, tricks and tutorial examples of commands and batch files

Some tips, tricks, examples to create, edit and customize the batch file. Solve problems and conflicts of use. Tutorial below commands and batch files, trivia, jokes, annexes.
After you have read the previous page to enter in a basic way to create batch files, if you are interested and attracted to the subject, you will find information that will help in editing and creation of these small tools. 
They are grouped and summarized on this page some of the answers to simple and practical issues that most often cause us to reach users

Create greetings in batch files.

A little to impress the naive or people with little knowledge, or just make you start your applications so friendly to make your batch files can include the user name in the introduction, greeting or beginning of the batch file as follows:
@ Echo off echo Welcome% username%, want to continue? 
pause> nul

How to display messages in batch files.

On the previous page showed the basic form of display messages in batch files:
msg * here's the text of the message
but the result is a little dry. 
scripts in VBScript events offer more expressive messages, so it is possible to link two files as follows. Create a batch file to write a script temporarily and then run it , it seems difficult but is easy. Try the following code:
@ Echo offecho MsgBox "Writing a script and then call it." 64, "NorfiPC">% temp% \ mensaje.vbs 
start% temp% \ mensaje.vbs
As you can see has a different style with an icon, title and even sound. Simply insert the text you want displayed on the message and the title will have the upper window. 
scripts created in this manner are stored in the Temp folder where it will cause discomfort and will be deleted when running cleanmgr.exe . 
In the same way before you can generate messages with icons and sounds different using the following lines:
MsgBox "Error message icon", 0, "Error"
MsgBox "Error message icon," 16, "Error"
MsgBox "message icon interrogation," 32, "polling"
MsgBox "message warning icon," 48, "Warning"
MsgBox "information icon message," 64, "Information"
MsgBox "message icon Application", 4096, "Application"

Chaining the batch files with scripts.

By chaining batch-script files in the above manner, we can expand and enrich the possibilities for different actions with batch scripts and have more resources at their disposal. The following examples make use of the method  SendKeys , with which it is possible to send commands to the keyboard just as if we did physically, are just two examples but can do many different things. The first sends the combination  Ctrl + Shift + Escape  starts with what the Task Manager. The second key  F3  thus opens the Windows Search tool. Try them.
@ Echo off ECHO set WshShell = WScript.CreateObject ("WScript.Shell")>% temp% \ tskm.vbs 
miss WshShell.SendKeys "^ + {ESC}" >>% temp% \ tskm.vbs 
start% temp% \ tskm.vbs 
cast set WshShell = WScript.CreateObject ("WScript.Shell")>% temp% \ buscar.vbs 
miss WshShell.SendKeys "{F3}" >>% temp% \ buscar.vbs 
start% temp% \ search. vbs

How to change the icon that shows the batch file.

In Windows by default, the batch file extension. CMD, like the bat extension. BAT, show the same icon of the two wheels. You can use another icon, this requires modifying the registry key which specifies the value. The registry key that contains information about the batch file is as follows:
HKEY_CLASSES_ROOT \ cmdfile \ DefaultIcon
and value, that is the path to the icon used by default is:
% SystemRoot% \ System32 \ imageres.dll, -68
You can use some of the icons used for executables exe only taking two clicks in the default and pasting one of the following routes:
% SystemRoot% \ System32 \ imageres.dll, -15 
% SystemRoot% \ System32 \ imageres.dll, -87
You can change the specified key using the command line, for it uses the following code in a batch file or by entering directly into the console, Start or Run.
REG ADD HKEY_CLASSES_ROOT \ cmdfile \ DefaultIcon / ve / t REG_EXPAND_SZ / d C: \ Windows \ System32 \ imageres.dll, -15 / f
Use the command line to make changes to the Windows registry is dangerous, any mistake in a character can be disastrous, so I advise caution and only carry them out if you have basic knowledge in editing the registry.
After you make the above modification to restart the computer or just restart explorer.exe, so that changes become effective, unless you know how to create a batch file with the following code and run it:
@ ECHO OFF 
taskkill / F / IM explorer.exe 
timeout / nobreak 04 
start explorer.exe
You can also restart your browser otherwise, copy the following code, paste it directly into the Start or Run box and press Enter:
CMD / C taskkill / F / IM explorer.exe & timeout / nobreak 04 & start explorer.exe

Restoring the association of the batch file (cmd) and bat (bat).

Windows uses file extensions to know what kind of information they contain and therefore that it is necessary to run programs, sometimes this association is impaired by various causes and then files are displayed with an unknown file type icon and give two clicks in them opens the dialog box to choose the program need to stop opening.
To restore the association of the batch file cmd file extension, open a command window and paste the following and press Enter: assoc. cmd should return the following:. cmd = cmdfile if not well written: assoc. cmd = cmdfile If this does not resolve the situation using the following REG file and add the key that contains your registration.



Key to restore the CMD file association
Windows Registry Editor Version 5.00 
[HKEY_CLASSES_ROOT \. CMD] 
@ = "cmdfile"
[HKEY_CLASSES_ROOT \. CMD \ PersistentHandler] 
@ = "{bf96-11cd-5e941d80-b579-08002b30bfeb}"
[HKEY_CLASSES_ROOT \ cmdfile] 
@ = "Windows Command




[HKEY_CLASSES_ROOT\cmdfile\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,36,\
00,38,00,00,00
[HKEY_CLASSES_ROOT \ cmdfile \ shell]
[HKEY_CLASSES_ROOT \ cmdfile \ shell \ edit]
[HKEY_CLASSES_ROOT\cmdfile\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
00
[HKEY_CLASSES_ROOT \ cmdfile \ shell \ open] 
"EditFlags" = hex: 00,00,00,00
[HKEY_CLASSES_ROOT \ cmdfile \ shell \ open \ command] 
@ = "\"% 1 \ "% *"
[HKEY_CLASSES_ROOT\cmdfile\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,\
00,25,00,31,00,00,00
[HKEY_CLASSES_ROOT \ cmdfile \ shell \ runas] 
"HasLUAShield" = ""
[HKEY_CLASSES_ROOT\cmdfile\shell\runas\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,6d,00,\
64,00,2e,00,65,00,78,00,65,00,20,00,2f,00,43,00,20,00,22,00,25,00,31,00,22,\
00,20,00,25,00,2a,00,00,00
[HKEY_CLASSES_ROOT\cmdfile\shell\runasuser]
@=”@shell32.dll,-50944″
“Extended”=”"
“SuppressionPolicyEx”=”{F211AA05-D4DF-4370-A2A0-9F19C09756A7}”
[HKEY_CLASSES_ROOT\cmdfile\shell\runasuser\command]
“DelegateExecute”=”{ea72d00e-4960-42fa-ba92-7792a7944c1d}”
[HKEY_CLASSES_ROOT \ cmdfile \ shellex \ ContextMenuHandlers] 
@ = "Compatibility"
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\ContextMenuHandlers\Compatibility]
@=”{1d27f844-3a1f-4410-85ac-14651078412d}”
[HKEY_CLASSES_ROOT \ cmdfile \ ShellEx \ DropHandler] 
@ = "{86C86720-42A0-1069-A2E8-08002B30309D}"
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\PropertySheetHandlers\PifProps]
@=”{86F19A00-42A0-1069-A2E9-08002B30309D}”
[HKEY_CLASSES_ROOT \ cmdfile \ ShellEx \ PropertySheetHandlers \ ShimLayer Property Page] 
@ = "{-2A8E-4F51 513D916F-AEAB-0CBC76FB1AF8}"
[HKEY_CLASSES_ROOT\cmdfile\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@=”{1531d583-8375-4d3f-b5fb-d23bbd169f22}”
[-HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ FileExts \. CMD \ UserChoice]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.CMD\OpenWithProgids]
“cmdfile”=hex(0):
To restore the file association bat bat file extension, open a command window, paste the following and press Enter: assoc. bat  should return the following:. bat = batfile if not well written: assoc. bat = batfile  If this does not resolve the situation using the following REG file and add the key that contains your registration.



Key to restore the file association BAT
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT \. BAT] 
@ = "batfile"
[HKEY_CLASSES_ROOT \. BAT \ PersistentHandler] 
@ = "{bf96-11cd-5e941d80-b579-08002b30bfeb}"
[HKEY_CLASSES_ROOT \ batfile] 
@ = "Windows Batch




[HKEY_CLASSES_ROOT\batfile\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,36,\
00,38,00,00,00
[HKEY_CLASSES_ROOT\batfile\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
00
[HKEY_CLASSES_ROOT \ batfile \ shell \ open] 
"EditFlags" = hex: 00,00,00,00
[HKEY_CLASSES_ROOT \ batfile \ shell \ open \ command] 
@ = "\"% 1 \ "% *"
[HKEY_CLASSES_ROOT\batfile\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,\
00,25,00,31,00,00,00
[HKEY_CLASSES_ROOT \ batfile \ shell \ runas] 
"HasLUAShield" = ""
[HKEY_CLASSES_ROOT\batfile\shell\runas\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,6d,00,\
64,00,2e,00,65,00,78,00,65,00,20,00,2f,00,43,00,20,00,22,00,25,00,31,00,22,\
00,20,00,25,00,2a,00,00,00
[HKEY_CLASSES_ROOT\batfile\shell\runasuser]
@=”@shell32.dll,-50944″
“Extended”=”"
“SuppressionPolicyEx”=”{F211AA05-D4DF-4370-A2A0-9F19C09756A7}”
[HKEY_CLASSES_ROOT\batfile\shell\runasuser\command]
“DelegateExecute”=”{ea72d00e-4960-42fa-ba92-7792a7944c1d}”
[HKEY_CLASSES_ROOT \ batfile \ shellex \ ContextMenuHandlers] 
@ = "Compatibility"
[HKEY_CLASSES_ROOT\batfile\ShellEx\ContextMenuHandlers\Compatibility]
@=”{1d27f844-3a1f-4410-85ac-14651078412d}”
[HKEY_CLASSES_ROOT \ batfile \ ShellEx \ DropHandler] 
@ = "{86C86720-42A0-1069-A2E8-08002B30309D}"
[HKEY_CLASSES_ROOT\batfile\ShellEx\PropertySheetHandlers\PifProps]
@=”{86F19A00-42A0-1069-A2E9-08002B30309D}”
[HKEY_CLASSES_ROOT \ batfile \ ShellEx \ PropertySheetHandlers \ ShimLayer Property Page] 
@ = "{-2A8E-4F51 513D916F-AEAB-0CBC76FB1AF8}"
[HKEY_CLASSES_ROOT\batfile\ShellEx\{8895b1c6-b41f-4c1c-a562-0d564250836f}]
@=”{1531d583-8375-4d3f-b5fb-d23bbd169f22}”
[-HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ FileExts \. BAT \ UserChoice]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.BAT\OpenWithProgids]
“batfile”=hex(0):

How to convert batch files into exe (executable).

When you create your batch files to make your own tasks can become the easily executable, this will in some cases provide advantages and benefits. Some are:
1 - There may be amended using the text editor in the same way that the batch to right click, which will prevent deterioration by accident. 
2 - If the execution of the batch to use auxiliary files such as images, icons, text files etc.. able to group and encapsulate them all in one exe file (executable) created. 
3 - Impedirás display the code used in their creation (not my style). 
4 - You will laugh at those who feel aversion (unjustified) against BAT files .
Can be created in two ways. 
a) Using the tool provided with Windows for that purpose, it is easy to use just follow the wizard. To start box type in the Start or Run: iexpress.exe  and press Enter. 
b) Download the following application  Bat To Exe Converter  on the website of the author at:  http://www.f2ko.de
Both applications include options to add passwords to the file created to run it, an icon of your choice, comments, etc..

How to insert letters with accents in batch files.

In batch files for letters that have accents, and other special characters ñ own Spanish language and display correctly on the console cmd to run the batch, the method requires the use of  alt codes .

Tips, suggestions and examples for creating batch files.


Using Wildcards.

The asterisk sign  *  replaces strings of characters. 
For example, using  DIR *. txt  specific that lists all files in that directory with the extension  . txt . 
The question mark  ?  replaced but only one character. You can specify more question marks. So if you specify  dir s??? *. *  we would list the directories and files with a name beginning with  
s  and other  3  letters any more about any character, then it  *  does that lists files with any extension.

Simple examples to practice:

Examples of information possible to retrieve and display the user using a batch. 
To run it, like the following code, copy it, paste it into a text file and save it with any name but has the file extension. cmd.
@ Echo off 
Color 07 
cast This is an example batch file 
pause 
cls 
echo The Time 
pause> nul 
cls 
date / t 
time / t 
pause> nul 
cls 
Let's change the color cast 
pause> nul 
Color 1E 
cls 
ECHO Who are you 
pause > nul 
cls 
echo% username% 
pause> nul 
miss Your task in execution 
pause> nul 
tasklist 
pause> nul 
cls 
cast your system information 
systeminfo 
pause> nul 
CLS 
directory miss in that these 
pause> nul 
cls 
echo% CD% 
pause> nul 
miss Sounds like you have a virus 
pause> nul 
@ echo
It's just a joke 
pause> nul 
exit
Simple example of interactive use of the SET command.
@ Echo off 
title Name 
set / p name = Enter your name and press Enter. 
set / p name = Enter your first name? 
set / p apellido2 = enter your last name? 
echo. 
echo Your name is% name%% apellido2% name%% 
pause> nul 
exit
Example of a simple mathematical calculation, calculate the average of two numbers.
@ Echo off 
title Do numbers mean of two 
set / p num1 = What is the first number? 
set / p num2 = What is the second number? 
set / mid = (% num1 num2%% +%) / 2 
echo. 
miss The average mean%% 
pause> nul 
exit
Another example of calculating the average, in this case between various numbers.
@ Echo off 
title mean Make two numbers 
: the top 
set / p = cant numbers between those who want to do the mean? 
set / a counter =% qty% 
set total = 0 
if% qty% LSS 2 (goto bad) else (goto question ) 
: wrong 
cast must enter a number greater than or equal to 2 
goto start 
: question 
set / p num =% Type one of the numbers cant% 
set / a total =% total% +% num% 
set / a counter =% counter% -1 
if not% count% == 0 (goto question) 
September / mid =% total% /% qty% 
echo. 
echo The average mean%% 
pause> nul 
exit
Another example of a simple mathematical operation.
@ Echo off 
title Division of two numbers 
set / p a = Enter the numerator 
: denominator 
set / p two = Enter the denominator 
if% two% == 0 (goto nosepuede) else (goto split) 
: nosepuede 
echo The denominator can not be zero. 
goto denominator 
: Divide 
set / three =% a% /% two% 
echo The result of% a% /% two% three% is% 
pause> nul 
exit
Sample loop, ie the infinite repetition, in this case of two lines.
@ Echo off 
title loop example 
0A Color 
: loop 
cast 1001010010010100100101001010010010100100101001010010010100100101001010010010 
0110101101101011011010110101101101011011010110101101101011011010110110101101 miss 
goto loop 
exit

Saturday, 2 June 2012

how to synchronize your Gmail Account

If you have a Gmail account and use it in mobile system Android, know that a lot of data syncs Gmail with your phone and you may want to change some things ... For this you have to open settings.
Among the list of apps and synchronization Accounts screen, find and open the settings for Gmail app. On the next screen will show the various types of data to be synchronized.
Learn how to synchronize your Gmail account
Gmail shows many options. In addition to synchronizing e-Mobile you can synchronize contacts, albums and calendar you have access to. Uncheck what you do not want to synchronize
Once you've chosen what you want to sync, click on Settings on your phone and select Accounts and sync now on the  part bottom of the screen. youe account begin to synchronize data at the time.
When finished, exit the Settings menu and open your Gmail app. See what has been updated within the app. If for some reason the changes have not taken effect, repeat the above steps again.

5 tricks and tips to increase safety at work (II)

In this section on tips and tricks we have already submitted five tricks and tips on how to increase workplace safety . This time you will find five new tricks and tips that should apply without delay to increase the security of their IT.
 
  1. Password protect the screen saver
    Sometimes we housekeeper's desk longer than expected. As this type of situation is common, you should password protect the screen saver according to this handy trick and tip. Your computer will crash when the specified time elapses.
    Follow these steps to password protect the screen saver in Windows 7:
    • Click the right mouse button anywhere on the desktop.
    • Click Customize , and then, under Screen Saver .
    • Change the timeout to 10 minutes or less.
    • Select Show the logon screen on resume .
    • Click Apply .
  2. Encrypt files containing confidential or business critical
    On your computer saves valuable and confidential data. For example, you may keep confidential information about your company or clients, or their personal bank statements, on a laptop used at home and at work. Encrypting data ensures that they maintain the highest level of protection.To prevent unauthorized users from gaining access to this information (although the computer is stolen or lost), you should encrypt all sensitive data. If you have Enterprise or Ultimate edition of Windows Vista, you can use the BitLocker ™ Drive Encryption to encrypt the entire hard drive.When using Windows XP or another edition of Windows Vista, you can use the Encrypting File System (EFS) to protect important information. We strongly recommend reading the following tips and tricks to learn how to encrypt a file or folder and keep them safe.
  3. Do not open e-mails of questionable origin
    Among the tips and tricks is this classic: If you receive an email with a strange look, it is likely that its contents are not reliable. Forward the email to your IT administrator to check that does not contain viruses or malware before opening it.
  4. Encrypt email messages when appropriate
    If you are sending confidential or business critical, encrypt email and attachments. Thus, only be read by recipients with the private key that matches the public key you used to encrypt the message.
  5. Use filter spam in Outlook
    It's really annoying to receive e-mail spam, also can contain viruses that cause damage to the equipment and the company network. The filter spam messages reduces the amount of spam you receive in your Inbox. By default, this filter is always active, but only captures the most obvious spam. Change the filter settings spam by following this advice and increase the security of your computer.
For more tips and tricks, back to News SME .

Tips and tricks to apply to iPad

Imagine for a moment that finally arrived in your hands one of the most famous tablets, after much delay, and you wonder what tricks I can learn to apply them in my new iPhone and so make the most? There are many ways to enjoy the benefits of your iPhone and learn more about this tablet, read on to discover them.
- Mute your iPad: You were enjoying an episode of your favorite series or movie from your iPhone and call you by phone, you need to quickly silence your tablet, then you just have to let the button to lower the volume until your team is fully in silence.
-Put your favorite websites on the screen: Let us follow the example of you were watching a series or movie on your iPhone and answer a call could not continue watching, because what you do is add the site to screen the tablet, that you do it by accessing the browser Safari , and being in the place you want to add to the home screen, press the symbol "+" and the option to "Add to Home Screen".
-Set a password to access the contents of your computer: Protect your hands iPad suspicious by a security password. You do this so easily, go to Settings -> General ->Passcode Lock . You set a security code of 4 digits, of your choice, and voila, you have your iPhone protected from view of others.
-Do not let your battery is consumed quickly, set the brightness of your iPhone:One of the things that might be bothering your iPhone is the battery life of the equipment, especially when we use 90% of the day. What you can do to prevent this from happening so quickly is lower the brightness of the screen. Go to "Settings" , then enter the option "brightness and background" and set this to a lower level.
-Make your search from Spotlight : This allows you to find your music or find your contacts quickly. Entering into this search engine from the iPad, writing the name of what you get do a search on both data stores (sounds and contacts) to find what you wanted.
- Load your tablet in the evening : After having used all day, ideally you connect your iPhone to this charge. Usually this team needs about 4 to 5 hours to charge.
Take these tips to help you apply for your iPhone and take advantage all the capacity offered by this team

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes