alfreire Posted June 12, 2013 Posted June 12, 2013 (edited) Hi... I tried restart Explorer from batch file with this command:taskkill /F /IM explorer.exestart explorer.exeExplorer close well, but start only file explorer, not desktop... In task manager there is a explorer restart option, is there any command to do that...?Regards... ;-) p.d.: in Win 7 x64 works...p.d.2: Execute those commands from 7z-sfx.... Edited June 12, 2013 by alfreire Quote
alfreire Posted June 12, 2013 Author Posted June 12, 2013 Sorry, if I use 7z-sfx x64 module works... X-DRegards...;-) p.d: if any moderator want delete this post, no matter... ;-) Quote
ricktendo Posted June 12, 2013 Posted June 12, 2013 Try without start.exe, just explorer.exeEdit: if you are on 64 bit use the x64: command in config.txtRunProgram="%%P:taskkill /F /IM explorer.exe"RunProgram="nowait:%%P:explorer.exe" Quote
alfreire Posted June 12, 2013 Author Posted June 12, 2013 Try without start.exe, just explorer.exeThanks, Rick... i will try, but with x64 module works...Regards... ;-) Quote
pitoloko Posted February 11, 2014 Posted February 11, 2014 Explorer close well, but start only file explorer, not desktop.... I were in the same problem of you and I've developed time ago a mini-tool in .NET (VB) to solve that issue.You can compile this Class into an exe and just run the compiled exe, the entire desktop is shown not only a explorer window like happened using CMD.But my program is not for restart explorer, it don't kills explorer, it just start it, so if you want to kill explorer then you need to write that isntruction (in Batch for example using TaskKill command like you was using in your example).PS: If you want the program compiled then here is: http://www.mediafire.com/download/olj659v29ao8gdv/InitializeExplorer.exeThe source is just a CLI app with a Module containning these lines:' By Elektro#Region " Imports "Imports System.IOImports System.Runtime.InteropServicesImports InitializeExplorer.NativeMethods#End Region''' ''' Initializes a new instance of Explorer process.''' Module InitializeExplorer#Region " P/Invoke " ''' ''' Class NativeMethods. ''' Friend Class NativeMethods ''' ''' Retrieves a handle to the top-level window whose class name and window name match the specified strings. ''' This function does not search child windows. ''' This function does not perform a case-sensitive search. ''' ''' ''' The class name or a class atom created by a previous call to the ''' RegisterClass or RegisterClassEx function. ''' The atom must be in the low-order word of lpClassName; ''' the high-order word must be zero. ''' If lpClassName points to a string, it specifies the window class name. ''' The class name can be any name registered with RegisterClass or RegisterClassEx, ''' or any of the predefined control-class names. ''' If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter. ''' ''' ''' The window name (the window's title). ''' If this parameter is NULL, all window names match. ''' IntPtr. Public Shared Function FindWindowByClass( ByVal lpClassName As String, ByVal zero As IntPtr ) As IntPtr End Function End Class#End Region#Region " ReadOnly Strings " ''' ''' Indicates the directory where the Explorer process is located. ''' Private ReadOnly ExplorerDirectory As String = Environment.GetFolderPath(Environment.SpecialFolder.Windows) ''' ''' Indicates the filename of the process. ''' Private ReadOnly ExplorerFilename As String = "Explorer.exe" ''' ''' Indicates the desk Taskbar Class-name. ''' Private ReadOnly TaskBarClassName As String = "Shell_TrayWnd"#End Region#Region " Process " ''' ''' The explorer process. ''' Dim Explorer As New Process With { .StartInfo = New ProcessStartInfo With { .FileName = Path.Combine(ExplorerDirectory, ExplorerFilename), .WorkingDirectory = My.Application.Info.DirectoryPath, .UseShellExecute = True, .CreateNoWindow = True } }#End Region#Region " Main " ''' ''' Defines the entry point of the application. ''' Sub Main() Select Case Convert.ToBoolean(CInt(FindWindowByClass(TaskBarClassName, Nothing))) Case False ' The Taskbar is not found. Try Explorer.Start() Console.WriteLine("Windows Explorer has been re-initialized successfully") Environment.Exit(0) Catch ex As Exception Console.WriteLine(ex.Message) Debug.WriteLine(ex.Message) Environment.Exit(1) End Try Case True ' The Taskbar is found. Console.WriteLine("Can't proceed, Windows Explorer is currently running. Exiting...") Environment.Exit(2) End Select End Sub#End RegionEnd Module alfreire 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.