diff --git a/IPython/genutils.py b/IPython/genutils.py
index edac109..450b380 100644
--- a/IPython/genutils.py
+++ b/IPython/genutils.py
@@ -5,7 +5,7 @@ General purpose utilities.
 This is a grab-bag of stuff I find useful in most programs I write. Some of
 these things are also convenient when working at the command line.
 
-$Id: genutils.py 971 2005-12-29 18:30:45Z fperez $"""
+$Id: genutils.py 972 2005-12-29 18:45:19Z fperez $"""
 
 #*****************************************************************************
 #       Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
@@ -308,6 +308,10 @@ def system(cmd,verbose=0,debug=0,header=''):
     if not debug: stat = os.system(cmd)
     return stat
 
+# This function is used by ipython in a lot of places to make system calls.
+# We need it to be slightly different under win32, due to the vagaries of
+# 'network shares'.  A win32 override is below.
+
 def shell(cmd,verbose=0,debug=0,header=''):
     """Execute a command in the system shell, always return None.
 
@@ -331,6 +335,27 @@ def shell(cmd,verbose=0,debug=0,header=''):
     if not debug:
         os.system(cmd)
 
+# override shell() for win32 to deal with network shares
+if os.name in ('nt','dos'):
+
+    shell_ori = shell
+
+    def shell(cmd,verbose=0,debug=0,header=''):
+        if os.getcwd().startswith(r"\\"):
+            path = os.getcwd()
+            # change to c drive (cannot be on UNC-share when issuing os.system,
+            # as cmd.exe cannot handle UNC addresses)
+            os.chdir("c:")
+            # issue pushd to the UNC-share and then run the command
+            try:
+                shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
+            finally:
+                os.chdir(path)
+        else:
+            shell_ori('"pushd %s&&"'%path+cmd,verbose,debug,header)
+
+    shell.__doc__ = shell_ori.__doc__
+
 def getoutput(cmd,verbose=0,debug=0,header='',split=0):
     """Dummy substitute for perl's backquotes.
 
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 2d30d9b..b008492 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,8 @@
 2005-12-29  Fernando Perez  <Fernando.Perez@colorado.edu>
 
+	* IPython/genutils.py (shell): commit Jorgen Stenarson's patch
+	(minor mods) to support network shares under win32.
+
 	* IPython/winconsole.py (get_console_size): add new winconsole
 	module and fixes to page_dumb() to improve its behavior under
 	win32.  Contributed by Alexander Belchenko <bialix-AT-ukr.net>.