長いパスを G:\マイドライブ\..\ActualPerformanceのように表示するスクリプトをPS1ファイルにコーディングして作ったのですが、VisualStudioCodeのpowershellで以下のエラーがでます。気になるのは、エラーのパスで、PowerShellprofile.ps1となっていますが、PowerShell\profile.ps1が正しいです。どうしたら治せるのでしょうか?アドバイスお願いします。
C:\Users\XXXXXX\Documents\PowerShellprofile.ps1: The term 'C:\Users\XXXXXX\Documents\PowerShellprofile.ps1' is not recognized as
a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again
念のため、スクリプト内容
function prompt {
$path = (Get-Location).Path -split '\\'
$pathLength = $path.Length
if ($pathLength -le 3) {
$path -join '\'
}
elseif ($pathLength -ge 4) {
$shortenedPath = $path[0], $path[1], '..', $path[-1]
$shortenedPath -join '\'
}
else {
"Error: Unable to process path for display"
}
"PS $($shortenedPath -join '\')>"
}
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
このQ&Aを見た人はこんなQ&Aも見ています
-
準・究極の選択
「年収1000万円で一生カレーライス」か 「年収180万円で毎日何でも食べ放題」 あなたはどちらを選びますか?
-
フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
あなたが普段思っている「これまだ誰も言ってなかったけど共感されるだろうな」というあるあるを教えてください
-
映画のエンドロール観る派?観ない派?
映画が終わった後、すぐに席を立って帰る方もちらほら見かけます。皆さんはエンドロールの最後まで観ていきますか?
-
海外旅行から帰ってきたら、まず何を食べる?
帰国して1番食べたくなるもの、食べたくなるだろうなと思うもの、皆さんはありますか?
-
天使と悪魔選手権
悪魔がこんなささやきをしていたら、天使のあなたはなんと言って止めますか?
-
Powershellとコマンドプロンプト
その他(プログラミング・Web制作)
-
これなにがちがうんですか??
C言語・C++・C#
-
MacのPythonでの開発について
その他(プログラミング・Web制作)
-
-
4
C言語の関数と配列に関する質問
C言語・C++・C#
-
5
LeetCodeていうの初めて、
C言語・C++・C#
-
6
昔のパソコン少年の武勇伝「店先のパソコンでゲームを作成し、それを売り、その金でパソコンを買う」本当?
その他(プログラミング・Web制作)
-
7
httpリクエストの送り元の特定
その他(プログラミング・Web制作)
-
8
double型が正常に認識されていない恐れ
C言語・C++・C#
-
9
gccを行ってもexeファイルが生成されない
C言語・C++・C#
-
10
最新のプログラム言語を学ぶには何がいいですか?
その他(プログラミング・Web制作)
-
11
C++6.0でのresource.hについて
C言語・C++・C#
-
12
エクセルVBAの配列について
Visual Basic(VBA)
-
13
質問失礼します。 プログラム言語を一つも知らないのですが、C♯の勉強をしてみたいです。おすすめの教材
C言語・C++・C#
-
14
pythonの条件分岐(if)
その他(プログラミング・Web制作)
-
15
MACで動く実行ファイルをWindowsで作る方法(クロスコンパイラ紹介ください)
C言語・C++・C#
-
16
ものづくりに向いているプログラミング言語ってなんですか?家電にもプログラミングが使われてるとか
その他(プログラミング・Web制作)
-
17
python の 連鎖代入の文法
その他(プログラミング・Web制作)
-
18
Pythonでターミナルに文字を出力する命令を出せるprintが予約語でないのは何故ですか。予約語は
その他(プログラミング・Web制作)
-
19
vba クリップボードクリアについて教えてください
その他(プログラミング・Web制作)
-
20
家庭のパソコンで Python の 環境構築を行います。 windows 11 です 事情があって
その他(プログラミング・Web制作)
関連するカテゴリからQ&Aを探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・人生のプチ美学を教えてください!!
- ・10秒目をつむったら…
- ・あなたの習慣について教えてください!!
- ・牛、豚、鶏、どれか一つ食べられなくなるとしたら?
- ・【大喜利】【投稿~9/18】 おとぎ話『桃太郎』の知られざるエピソード
- ・街中で見かけて「グッときた人」の思い出
- ・「一気に最後まで読んだ」本、教えて下さい!
- ・幼稚園時代「何組」でしたか?
- ・激凹みから立ち直る方法
- ・1つだけ過去を変えられるとしたら?
- ・【あるあるbot連動企画】あるあるbotに投稿したけど採用されなかったあるある募集
- ・【あるあるbot連動企画】フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
- ・映画のエンドロール観る派?観ない派?
- ・海外旅行から帰ってきたら、まず何を食べる?
- ・誕生日にもらった意外なもの
- ・天使と悪魔選手権
- ・ちょっと先の未来クイズ第2問
- ・【大喜利】【投稿~9/7】 ロボットの住む世界で流行ってる罰ゲームとは?
- ・推しミネラルウォーターはありますか?
- ・都道府県穴埋めゲーム
- ・この人頭いいなと思ったエピソード
- ・準・究極の選択
このQ&Aを見た人がよく見るQ&A
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
エクセルのマクロで特定フォル...
-
アプリケーションのインストー...
-
エクセルvbaでdocuworksprinter...
-
1行単位のデータをテキストファ...
-
VBS パスに変数を入れたい
-
パスワード保護されたExcelファ...
-
初心者powershellのPS1ファイル...
-
OleDbDataAdapterのエラー
-
C++でネットワークパスのファイ...
-
fopenでのパス指定
-
Eclipse
-
エクセルのファイルオープン時...
-
file://について
-
VB2005 でパス名が誤っていない...
-
エクセルVBAで一つ上の階層...
-
コマンドプロンプトのコピー関...
-
ファイルのアクセス回数について
-
エクセルで複数のコメントのサ...
-
エクセル2010、図が大きすぎま...
-
Wordで差込印刷した後に別々の...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
エクセルvbaでdocuworksprinter...
-
Excel 相対パス
-
エクセルVBAで一つ上の階層...
-
エクセルのマクロで特定フォル...
-
xcopyコマンドの進行状況を表示...
-
ExcelVBAの使い方 ¥の使い方...
-
EXCEL(VBA)で指定フォルダ内の...
-
【VBA】ExcelマクロでCSVファイ...
-
【VB.NET】App.configにファイ...
-
VBA★PDFをPDFアプリで印刷し...
-
ExcelのVBAで上書き保存を確...
-
VBAでパワーシェルを実行したい...
-
SaveAsの保存先について
-
outlook開けない
-
Eclipse
-
C#でのProcess.Startと変数path
-
開いているファイルを削除し、...
-
A列に記載されているフォルダ...
-
コマンドプロンプトのコピー関...
-
【VBA】複数のtxtファイルから...
おすすめ情報