开发者

Powershell: how to assign path in the beginning of a script

As a beginner: How can I place a path to folder in Powershell script? I would like to hard-code a path to a folder where the rest of the script would do some data munging. How to开发者_运维知识库 do that?


Do you mean?

$path = "C:\Windows"

Get-ChildItem $path

This will let you reference path in cmdlet parameters.

As per your comment:

Set-Location C:\Windows

will change working directory of the script to C:\Windows

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜