<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: bat code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 28 Aug 2008 19:16:52 GMT</pubDate>
    <description>DZone Snippets: bat code</description>
    <item>
      <title>Code Of A Game</title>
      <link>http://snippets.dzone.com/posts/show/5171</link>
      <description>This Is A Code Of A Game.&lt;br /&gt;&lt;br /&gt;Coppy It Into Notepad And Then Save It As Game.bat&lt;br /&gt;&lt;br /&gt;Warning!&lt;br /&gt;Make Sure It Says "All Files (*.*)" And Not "Text Document (.txt)" At The Bottom.&lt;br /&gt;The Code Is:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;@echo off&lt;br /&gt;goto verybegingame&lt;br /&gt;: verybegingame&lt;br /&gt;echo Welcome To This Game!&lt;br /&gt;title Game Start&lt;br /&gt;echo Press Any Key For Stuff.&lt;br /&gt;pause &gt;nul&lt;br /&gt;echo Loading...&lt;br /&gt;ping localhost 6 &gt;nul&lt;br /&gt;echo.. Loading Comple!&lt;br /&gt;pause &gt;nul&lt;br /&gt;cls&lt;br /&gt;echo Rules:&lt;br /&gt;title Game Rules&lt;br /&gt;echo..You Answer Each Question.&lt;br /&gt;echo. If It Is Correct, You Will Move On.&lt;br /&gt;echo If It is InCorrect, The Program Will&lt;br /&gt;echo Exit And You Will Need To Try Again.&lt;br /&gt;echo.. If You Get All The Questions Right, You&lt;br /&gt;echo Will Receave A Speical Code.&lt;br /&gt;echo Enter THe Code For A Suprse!&lt;br /&gt;echo...&lt;br /&gt;echo Good Luck!&lt;br /&gt;echo.....&lt;br /&gt;echo Press A Key Of An Option, And Then &lt;br /&gt;echo Press 'Enter'.&lt;br /&gt;echo...&lt;br /&gt;echo                        1 = Play Game          2 = Enter Code&lt;br /&gt;SET /P "onechoose1=Enter 1 or 2 option here:"&lt;br /&gt;If %onechoose1%= 1 then goto playgame&lt;br /&gt;If %onechoose1%= 2 then goto entercode&lt;br /&gt;:playgame&lt;br /&gt;cls&lt;br /&gt;echo What Is My Name?&lt;br /&gt;echo A.Jonathan&lt;br /&gt;echo B.Sam&lt;br /&gt;echo C.Johnn&lt;br /&gt;SET /p "q1=Enter Option:"&lt;br /&gt;If NOT%q1%= A then exit&lt;br /&gt;:entercode&lt;br /&gt;echo  Enter Code&lt;br /&gt;SET /P "codeenter= "&lt;br /&gt;If %entercode%=code... goto prize&lt;br /&gt;:prize&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;All Of ThAT...&lt;br /&gt;MAKE MORE QUESTIONS.&lt;br /&gt;etc.&lt;br /&gt;</description>
      <pubDate>Mon, 25 Feb 2008 01:01:48 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5171</guid>
      <author>jmprogrammer (Jonathan Moore)</author>
    </item>
    <item>
      <title>Batch code to make win folder hidden and password protected</title>
      <link>http://snippets.dzone.com/posts/show/4244</link>
      <description>Open any text editor and copy the the contents of this code to a text file and save it with any name having .bat extension.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;cls&lt;br /&gt;@ECHO OFF&lt;br /&gt;echo 			// Check1 (In Main Function)&lt;br /&gt;title Folder LockFolder&lt;br /&gt;if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLockFolder&lt;br /&gt;if NOT EXIST LockFolder goto MDLockFolder&lt;br /&gt;:AuthConfirm&lt;br /&gt;echo Are you sure u want to Lock Folder  (Y/N)&lt;br /&gt;set/p "cho=&gt;"&lt;br /&gt;if %cho%==Y goto LockFolder&lt;br /&gt;if %cho%==y goto LockFolder&lt;br /&gt;if %cho%==n goto END&lt;br /&gt;if %cho%==N goto END&lt;br /&gt;echo Invalid choice.&lt;br /&gt;goto AuthConfirm&lt;br /&gt;:LockFolder&lt;br /&gt;ren LockFolder "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"&lt;br /&gt;attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"&lt;br /&gt;echo Folder LockFolder Locked!&lt;br /&gt;goto End&lt;br /&gt;:UNLockFolder&lt;br /&gt;echo Enter password to Unlock Folder&lt;br /&gt;set/p "pass=&gt;"&lt;br /&gt;if NOT %pass%==TYPE YOUR PASSWORD HERE goto FailUnlock&lt;br /&gt;attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"&lt;br /&gt;ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" LockFolder&lt;br /&gt;echo Folder UnLocked successfully!&lt;br /&gt;goto End&lt;br /&gt;:FailUnlock&lt;br /&gt;echo Invalid password!&lt;br /&gt;echo Try again?  (Y/N)&lt;br /&gt;set/p "choice=&gt;"&lt;br /&gt;if %choice%==Y goto UNLockFolder&lt;br /&gt;if %choice%==y goto UNLockFolder&lt;br /&gt;if %choice%==N goto END&lt;br /&gt;if %choice%==n goto END&lt;br /&gt;:MDLockFolder&lt;br /&gt;echo 			// Check2 (In MD Dir Function)&lt;br /&gt;md LockFolder&lt;br /&gt;echo Folder LockFolder created successfully!&lt;br /&gt;goto End&lt;br /&gt;:End&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 04 Jul 2007 09:02:59 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4244</guid>
      <author>scidmark (Pardeep Bukarwal)</author>
    </item>
    <item>
      <title>One-click connect from cygwin to full-screen Linux (X stuff required)</title>
      <link>http://snippets.dzone.com/posts/show/1298</link>
      <description>Optional: execute the following once (see http://hacks.oreilly.com/pub/h/66 for &lt;br /&gt;details), to avoid typing in the password.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;set LINUX_HOST=mylinuxhost&lt;br /&gt;ssh-keygen -t rsa&lt;br /&gt;ssh %USERNAME%@%LINUX_HOST% "mkdir .ssh; chmod 0700 .ssh"&lt;br /&gt;bash -c 'scp ~/.ssh/id_rsa.pub %LINUX_HOST%:.ssh/authorized_keys2'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now, if you save the following as a BATCH file, you can just click it &lt;br /&gt;to connect to fullscreen Linux: &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;set LINUX_HOST=mylinuxhost&lt;br /&gt;start /min xinit &lt;br /&gt;xhost +%LINUX_HOST%&lt;br /&gt;ssh %LINUX_HOST% "declare -x DISPLAY=%COMPUTERNAME%:0; echo $DISPLAY;gnome-session"'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;NOTES: &lt;br /&gt;1. &lt;br /&gt;Sometimes xhost + does not execute in time. O well. Just close&lt;br /&gt;all windows that got opened and try again.&lt;br /&gt;&lt;br /&gt;2.&lt;br /&gt;If you didn't do the step one (ssh keys), you will be prompted &lt;br /&gt;to enter the linux password; this increases the chances of the above&lt;br /&gt;error.&lt;br /&gt;&lt;br /&gt;3.&lt;br /&gt;The single terminal window appearing in the Linux desktop is in fact &lt;br /&gt;a window from your PC. &lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Wed, 25 Jan 2006 22:13:49 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1298</guid>
      <author>debedb (http://www.hrum.org)</author>
    </item>
    <item>
      <title>Lowercasing a string in BAT files</title>
      <link>http://snippets.dzone.com/posts/show/554</link>
      <description>Using &lt;a href=http://www.bigbold.com/snippets/posts/show/553&gt;this silliness&lt;/a&gt;, here's an example of BAT file that will&lt;br /&gt;lower-case a string given as an argument.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;echo&gt;%1&lt;br /&gt;dir /b/l %1&gt;lower.tmp&lt;br /&gt;set /p result=&lt;lower.tmp&lt;br /&gt;echo %result%&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Saving this as lower.bat, I run &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;lower "HELLO WORLD"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and get &lt;br /&gt;&lt;br /&gt;hello world&lt;br /&gt;&lt;br /&gt;as a result</description>
      <pubDate>Fri, 05 Aug 2005 06:30:21 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/554</guid>
      <author>debedb (http://www.hrum.org)</author>
    </item>
    <item>
      <title>Using Unix shell's backquote functionality in DOS/Windows batch files</title>
      <link>http://snippets.dzone.com/posts/show/553</link>
      <description>In BAT files, an equivalent of a Unix shell's&lt;br /&gt;&lt;code&gt;&lt;br /&gt;set foo `bar`&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;can be accomplished as&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;bar&gt;bar.tmp&lt;br /&gt;set /p foo=&lt;bar.tmp&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you're spoiled by Unix's notion of &lt;br /&gt;true pipes, note that the following:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;bar | set /p foo=&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;does not work.</description>
      <pubDate>Fri, 05 Aug 2005 06:23:23 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/553</guid>
      <author>debedb (http://www.hrum.org)</author>
    </item>
  </channel>
</rss>
