打开文件夹并最大化文件夹窗口 [英] Open folder and maximise the folder window

查看:153
本文介绍了打开文件夹并最大化文件夹窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下简单的 Powershell 脚本:

I have the following simple Powershell script:

ii E:\Source\Development\websites\example.com.au\root
ii E:\Source\Development\websites\example.com.au
ii E:\Source\Development\websites\example.com.au\css
ii E:\Source\Development\websites\example.com.au\database
ii E:\Source\Development\websites\example.com.au\js

但是,当文件夹窗口打开时,它们通常不会全屏最大化.我必须手动单击每个文件夹的窗口,然后从窗口菜单中选择最大化".对于比所示示例长得多的脚本(例如 20 多个窗口),这很烦人.有谁知道使用powershell最大化这些文件夹窗口?

However, when the folder windows open, they are often not maximised at full screen. I have to manually click on each folder's window and then select 'Maximize' off the window's menu. This is annoying for scripts that are much longer than the example shown (e.g. 20 plus windows). Does anyone know to maximise these folder windows using powershell?

推荐答案

使用 AppActivate 方法,不要忘记发送 Enter 键获得焦点,然后 Alt Spacebar X ("% X") 最大化.

Use AppActivate method, don't forget to send Enter key to gain focus, then Alt Spacebar X ("% X") to maximize.

$folder = "C:\Temp"
ii $folder
Start-Sleep -m 100
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
[Microsoft.VisualBasic.Interaction]::AppActivate("$folder")
Start-Sleep -m 100
[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait("% X")

绕一个圈就可以了.

这篇关于打开文件夹并最大化文件夹窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆