Windows

From WhyNotWiki

Jump to: navigation, search

Windows  edit   (Category  edit)

Windows


Contents

[edit] Good Windows software

Good Windows software edit


Backup software

http://www.cygwin.com/ -- GNU/Linux environment

[edit] Anti-Spyware

Spybot - Search & Destroy 1.4

[edit] Anti-virus

http://www.clamav.net/binary.html

[edit] Password tracker

KeePass Password Safe -- Looks very good. Open source.


[edit] Automation / Macros / Scripting

Have used: Yes
Rating: star_full.gif star_full.gif star_empty.gif
Homepage: http://www.autohotkey.com/


Project/Development: http://sourceforge.net/projects/ahk/


Description: Automate almost anything by sending keystrokes & mouse clicks (macros). Create hotkeys for keyboard, mouse, joystick, & handheld remote controls. Define abbreviations that expand as you type them (AutoText). Create graphical user interfaces & menu bars.


License: GPL
Environment: Windows





[edit] Lists of software

http://dag.wieers.com/howto/windows-apps/ DAG: Open Source Windows applications

 


[edit] Command line

[edit] How to make a Windows batch file that contains a Ruby script too

I learned this tricky technique from c:\ruby\bin\ruby\gem.bat . Apparently, they needed a way to make an executable "gem" command for Windows, and they wanted that gem command to be written in Ruby. This was the clever technique they used...

test.bat

@echo off
goto endofruby

#!/bin/ruby
puts
puts 'This is a Ruby script'
puts "Args: #{ARGV.join(' ')}"
__END__

:endofruby
echo This is a Batch file
echo %~d0
echo %~p0
echo "%~d0%~p0ruby"
echo %~f0
echo Args: %*

rem # -x[directory]   strip off text before #!ruby line and perhaps cd to 

directory
"%~d0%~p0ruby" -x "%~f0" %*
>test arg1 arg2
This is a Batch file
c:
\ruby\bin\
"c:\ruby\bin\ruby"
c:\ruby\bin\test.bat
Args: arg1 arg2

This is a Ruby script
Args: arg1 arg2


[edit] What's the equivalent of the GNU/Linux command 'which' on Windows?

[edit] star_full.gif star_full.gif star_empty.gif which_command gem

It's on RubyForge. Just gem install which_command.

C:\>which gem
c:\ruby\bin\gem.bat

C:\>whereis svn
svn: C:\Program Files\Subversion\bin\svn.exe


[edit] From Ruby

> irb
irb> require 'facets/core/fileutils/which'
irb> require 'facets/core/fileutils/whereis'

irb> ENV['PATH']
=> "C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\subwrap-0.3.3\\bin;c:\\ruby\\bin;C:\\Program Files\\Subversion\\bin"

# It finds .bat files with no trouble:
irb> FileUtils.which('gem')
=> "c:\\ruby\\bin\\gem.bat"

# But it currently has trouble finding .cmd files!

# This should return 
# "C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\subwrap-0.3.3\\bin\svn.cmd"
# since that directory is listed first in ENV['PATH']:

irb> FileUtils.which('svn')
=> "C:\\Program Files\\Subversion\\bin\\svn.exe"

irb> FileUtils.whereis('svn')
=> ["C:\\Program Files\\Subversion\\bin\\svn.exe"]

# but instead it only lists the svn.exe file

# Currently, the only way to find a .cmd file is to explicitly include .cmd in the string you pass to FileUtils.which

irb> FileUtils.which('svn.cmd')
=> "C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\subwrap-0.3.3\\bin\\svn.cmd"

irb> FileUtils.whereis('svn.cmd')
=> ["C:\\ruby\\lib\\ruby\\gems\\1.8\\gems\\subwrap-0.3.3\\bin\\svn.cmd"]

Ticket/patch: http://rubyforge.org/tracker/index.php?func=detail&aid=12397&group_id=804&atid=3171


[edit] In the Windows command shell

pankaj (2007-11-27). Equivalent of "which" in Windows Command Shell (http://www.pankaj-k.net/archives/2004/11/equivalent_of_w.html). Retrieved on 2007-05-11 11:18.


I have always missed the which utility of Unix under Windows, which doesn't seem to have built-in equivalent. So, when I came across batch script parameter modifiers while browsing Windows shell scripting, I decided to write a Windows equivalent of which:

@echo off
rem --------------------------------------------------------
rem File: which.cmd
rem Description: Windows equivalent of Unix which command
rem Author: Pankaj Kumar
rem Copyright 2004 Pankaj Kumar. All Rights Reserved.
rem License: This software is available under GPL
rem ---------------------------------------------------------
setlocal
if "%1" == "" goto noArg

set fullpath=%~$PATH:1
if "%fullpath%" == "" goto notFound
echo Found in PATH: %fullpath%
goto end

:noArg
echo No Argument specified
goto end

:notFound
echo Argument "%1" not found in PATH

:end
endlocal

Works pretty well!

[edit] Problem: It doesn't add the extensions for you

So even though I can type gemwhich from the command line, without any extension, and it will run c:\ruby\bin\gemwhich.bat, this which command will tell you it can't find any matches if you ask it about gemwhich without an extension:

> which gemwhich
Argument "gemwhich" not found in PATH

So to use which, you have to know what extension the file is:

> which gemwhich.bat
Found in PATH: c:\ruby\bin\gemwhich.bat

This is a bad thing, as often I will have no idea what extension it is. I don't want to tell which that; I want it to figure that out for me and tell me!

[edit] Problem: It gives false positives: returns matches for files that aren't actually executable

This is related to #Problem: It doesn't add the extensions for you

>dir c:\ruby\bin\rails.*
 Volume in drive C has no label.
 Volume Serial Number is 4C33-932F

 Directory of c:\ruby\bin

2007-07-17  11:12               352 rails
2007-07-17  11:12                30 rails.cmd
               2 File(s)            382 bytes
               0 Dir(s)   1,827,725,312 bytes free

So even though it is rails.cmd that gets executed when you type rails on the command line (rails.cmd turns out to simply be a wrapper that invokes the ruby interpreter with rails), which will (incorrectly) report rails:

>which rails
Found in PATH: c:\ruby\bin\rails


[edit] Tips

[edit] How to disable auto-login

control userpasswords2

(This is different from the User Accounts item listed in Control Panel. Terribly unintuitive.)

[edit] How to change where your application data is stored (%AppData%)

For the purposes of this exampe, I'll assume we're moving...

  • from C:\Documents and Settings\tylerrick\Application Data
  • to C:\AppData


On 2007-06-04, I was moving...

  • from \\LUMBERJACK\tylerrick\.Sys\Application Data
  • to C:\AppData

In the registry, I also had to replace all occurrences of %LOGONSERVER%\%USERNAME%\.Sys\Application Data.

 

... but really, it would work for any from/to location.

Close all programs that might use the %AppData% directory (that'd be most of them).

Download something like Registry Replace, and do a search for the old path and replace with the new path.

(This should change, among other things, the value of HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders. [1])

You can also set the APPDATA environment variable by going to My Computer/Properties/System/Advanced/.... But I'm not sure if that was necessary or not.

I found that even after making all those changes, it was still reporting the old path when I did echo %APPDATA% on the command line. I had to log off and log back in before %APPDATA% actually reported the new path. Then everything worked fine.

Facts about WindowsRDF feed
Licensed under GPL  +
Description [Oops! No type defined for attribute]
Personal tools