简体   繁体   English

PowerShell 设置要打开的文件夹

[英]PowerShell Setting up a folder to open in

My teacher gave me this instruction : "To set-up the default folder for PowerShell to open in, right click the PowerShell icon in the tool tray and select Properties. In the Properties dialog box and in the Start in: text box enter the path to the new directory “C:\\Users\\Administrator\\MyScripts”, then click OK."我的老师给了我这样的说明:“要设置 PowerShell 的默认打开文件夹,请右键单击工具栏中的 PowerShell 图标并选择“属性”。在“属性”对话框和“开始于:”文本框中输入路径到新目录“C:\\Users\\Administrator\\MyScripts”,然后单击“确定”。

However when I go into the properties tab I do not see what he is talking about :( .但是,当我进入属性选项卡时,我没有看到他在说什么:(。

This is what I see:这是我看到的:截屏

How do II Do what he wants? II 如何做他想做的事?

Your teacher is asking you to change the properties of the executable .您的老师要求您更改可执行文件的属性。 You are currently looking at the PowerShell console properties.您当前正在查看 PowerShell控制台属性。

As you can partially see mine is located:正如您可以部分看到的,我的位于:

%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe %SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe

在此处输入图片说明

By "tool tray" I assume your teacher meant the Windows taskbar and by "to set-up" I assume he/she meant "to set up" 1 : “工具托盘”我认为你的老师是指Windows 任务栏,“设置”我认为他/她的意思是“设置” 1

If you:如果你:

  • right-click the PowerShell icon in the taskbar, you get a shortcut menu,右键单击任务栏中的 PowerShell 图标,您会看到一个快捷菜单,
  • in which you can right-click the first entry in the last section to edit the properties of the shortcut file that started the application :您可以在其中右键单击最后一部分中第一个条目编辑启动应用程序快捷方式文件的属性

在此处输入图片说明

The resulting dialog will show you the desired Start in: field, which determines that shortcut file's startup folder:生成的对话框将向您显示所需的Start in:字段,该字段确定该快捷方式文件的启动文件夹:

在此处输入图片说明

Enter the desired startup folder ( C:\\Users\\Administrator\\MyScripts in your case), and click OK .输入所需的启动文件夹(在您的情况下为C:\\Users\\Administrator\\MyScripts ),然后单击OK

To determine the shortcut file's own location, switch to the General tab of the dialog and inspect the Location: field.要确定快捷方式文件自己的位置,请切换到对话框的General选项卡并检查Location:字段。

If you haven't yet pinned PowerShell to your taskbar, the Location: field probably contains C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Accessories\\Windows PowerShell .如果您尚未将 PowerShell 固定到任务栏,则Location:字段可能包含C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Accessories\\Windows PowerShell

The shortcut file's own name is Windows PowerShell.lnk , though the .lnk extension is typically hidden.快捷方式文件自己的名称是Windows PowerShell.lnk ,但.lnk扩展名通常是隐藏的。

In other words: by default, the shortcut file's full path is C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Accessories\\Windows PowerShell\\Windows PowerShell.lnk .换句话说:默认情况下,快捷方式文件的完整路径是C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Accessories\\Windows PowerShell\\Windows PowerShell.lnk

In general, shortcut files ( *.lnk ) store properties such as executable location, startup folder, initial window state, and shortcut key.通常,快捷方式文件 ( *.lnk ) 存储可执行位置、启动文件夹、初始窗口状态和快捷键等属性。


As for what you've tried:至于你尝试过的:

As Matt states in his answer , you've invoked the Properties dialog for the open PowerShell console window via its system menu (windows menu), which allows you to persistently change window properties, but not the startup folder.正如Matt 在他的回答中所述,您已经通过系统菜单(windows 菜单)为打开的 PowerShell 控制台窗口调用了Properties对话框,这允许您持续更改窗口属性,但不能更改启动文件夹。


1 "To set up" is a phrasal verb - no punctuation needed, and not to be confused with the noun derived from it, "setup". 1 “设置”是一个短语动词- 不需要标点符号,不要与从它派生的名词“设置”混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM