[Closed] Opening a Windows Explorer Window through .Net?
Hi Guys,
I am trying to build a really simple option to open up a windows explorer window with the path to a specified folder from a button in max.
It can be done pretty easily through the doscommand e.g
DOSCommand “explorer.exe “c:””
however, this flicks up the dos shell etc and looks a bit messy. Is there a way to do this through .NET. I have no experience with .NET, but I am trying to start integrating simple aspects of it. Does anyone know what classes I should be look at?
Any advice/examples would be super helpful!
Thanks,
Rich
Here is how to do that with .NET, the code is pretty small and easy to understand:
process = dotNetObject "System.Diagnostics.Process"
process.EnableRaisingEvents = false
process.StartInfo.FileName = "explorer"
process.StartInfo.Arguments = "C:\\"
process.Start()
A process starting explorer.exe with C: drive path as command line parameter is created.
Thanks for the super fast responses guys. Each example that I see of .NET is bringing me slightly closer to being able to implement something useful with it!
Also nice trick there Professor420, completely overlooked that!
Thanks for your time guys,
Rich
I can’t quite remember if this was on maxscript or another language… I’m looking for a similar command that will let me open the explorer, and highlight-select a specified file. All I need is to input a string path complete up to the filename of the file.
for example:
?Command? “c:\ emp\my_file.txt”
any help would be largely appreciated
Using the earlier .NET bit:
notepad = (sysinfo.windowsdir + "\
otepad.exe")
"C:\WINDOWS
otepad.exe"
process = dotNetObject "System.Diagnostics.Process"
dotNetObject:System.Diagnostics.Process
process.EnableRaisingEvents = false
false
process.StartInfo.FileName = "explorer"
"explorer"
process.StartInfo.Arguments = "/e,/select,\"" + notepad + "\""
"/e,/select,"C:\WINDOWS
otepad.exe""
process.Start()
true
Or straight shellLaunch works much the same:
shellLaunch "explorer.exe" "/e,/select,\"c:\\windows\
otepad.exe\""
Edit: also see…
http://support.microsoft.com/kb/130510
excellent! that was exactly what i needed! thanks a bunch!
also thanks for the link to the microsoft site, it never occured to me that the explorer.exe itself had switches.