{"id":1526,"date":"2024-01-28T15:53:26","date_gmt":"2024-01-28T06:53:26","guid":{"rendered":"https:\/\/hi3103.net\/notes\/?p=1526"},"modified":"2024-01-28T15:53:26","modified_gmt":"2024-01-28T06:53:26","slug":"powershell-%e3%82%b9%e3%82%af%e3%83%aa%e3%83%97%e3%83%88%e3%82%92-onedrive-%e3%81%ae%e4%b8%ad%e3%81%a7%e7%ae%a1%e7%90%86%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/hi3103.net\/notes\/windows\/1526","title":{"rendered":"PowerShell \u30b9\u30af\u30ea\u30d7\u30c8\u3092 OneDrive \u306e\u4e2d\u3067\u7ba1\u7406\u3059\u308b"},"content":{"rendered":"<h3>\u6982\u8981<\/h3>\n<ul>\n<li>Windows 11 \u4e0a\u3067\u3088\u304f\u884c\u3046\u64cd\u4f5c\u3092\u30b3\u30de\u30f3\u30c9\u3067\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u3001\u3061\u3087\u3044\u3061\u3087\u3044 PowerShell \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u308b\u3088\u3046\u306b\u306a\u3063\u305f<\/li>\n<li>\u30af\u30ea\u30fc\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3084\u8cb7\u3044\u66ff\u3048\u306a\u3069\u3067\u518d\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u969b\u3001\u7d20\u65e9\u304f\u5fa9\u65e7\u3067\u304d\u308b\u3088\u3046\u306b OneDrive \u4e0a\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7ba1\u7406\u3059\u308b<\/li>\n<\/ul>\n<h3>\u3084\u308b\u3053\u3068<\/h3>\n<ol>\n<li>OneDrive \u4e0a\u306b\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u4fdd\u5b58\u5834\u6240\u3092\u7528\u610f\u3059\u308b<\/li>\n<li><code>$profile<\/code> \u306b\u3001\u7528\u610f\u3057\u305f\u4fdd\u5b58\u5834\u6240\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u3059\u3079\u3066\u8aad\u307f\u8fbc\u3080\u8a2d\u5b9a\u3092\u8a18\u8ff0\u3059\u308b<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<h3>\u4f5c\u696d\u30ed\u30b0<\/h3>\n<h4>\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u7f6e\u304d\u5834\u3092\u7528\u610f<\/h4>\n<pre><code>C:\\Users\\\u30e6\u30fc\u30b6\u30fc\u540d\\OneDrive\\scripts\\profile\\<\/code><\/pre>\n<ul>\n<li>OneDrive \u3092\u5229\u7528\u3057\u3066\u3044\u308b\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u76f4\u4e0b\u306b OneDrive \u30d5\u30a9\u30eb\u30c0\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u308b\uff08\u591a\u5206\uff09<\/li>\n<li>PowerShell \u30b9\u30af\u30ea\u30d7\u30c8\u5c02\u7528\u306e\u7f6e\u304d\u5834\u6240\u3068\u3057\u3066\u3001script &gt; profile \u30d5\u30a9\u30eb\u30c0\u3092\u7528\u610f\u3057\u305f<\/li>\n<\/ul>\n<h4><code>$profile<\/code> \u3092\u7de8\u96c6<\/h4>\n<ol>\n<li>\n<p>Windows PowerShell \u3092\u8d77\u52d5<\/p>\n<\/li>\n<li>\n<p>\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u3001\u30e1\u30e2\u5e33\u3067\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f<\/p>\n<pre><code class=\"language-powershell\">notepad $profile<\/code><\/pre>\n<\/li>\n<li>\n<p>\u4ee5\u4e0b\u3092\u8a18\u8ff0\u3057\u3066\u4e0a\u66f8\u304d\u4fdd\u5b58\u3057\u3001\u30e1\u30e2\u5e33\u3092\u9589\u3058\u308b<\/p>\n<pre><code class=\"language-powershell\"># \u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u7528\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u4fdd\u5b58\u5834\u6240\u3092\u5b9a\u7fa9\n$customProfileDir = \"C:\\Users\\\u30e6\u30fc\u30b6\u30fc\u540d\\OneDrive\\scripts\\profile\"\n\n# \u4e0a\u8a18\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e .ps1 \u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u30a4\u30f3\u30dd\u30fc\u30c8\nGet-ChildItem -Path $customProfileDir -Filter \"*.ps1\" | ForEach-Object {\n    . $_.FullName\n}<\/code><\/pre>\n<\/li>\n<\/ol>\n<h4>\u52d5\u4f5c\u30c1\u30a7\u30c3\u30af<\/h4>\n<p>\u4ee5\u524d\u4f5c\u6210\u3057\u305f\u7591\u4f3c open \u30b3\u30de\u30f3\u30c9\u4f7f\u3063\u3066\u52d5\u4f5c\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<ol>\n<li>\n<p>\u4ee5\u4e0b\u306e\u30bd\u30fc\u30b9\u3092 <code>open.ps1<\/code> \u3068\u3057\u3066\u3001\u7528\u610f\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u7f6e\u304d\u5834\u306b\u4fdd\u5b58<\/p>\n<pre><code class=\"language-powershell\"># \u64ec\u4f3c\u7684\u306b open \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b\nSet-Alias -Name 'open' -Value Invoke-Item<\/code><\/pre>\n<\/li>\n<li>\n<p>Windows PowerShell \u3092\u518d\u8d77\u52d5\uff08\u3044\u3063\u305f\u3093\u9589\u3058\u3066\u958b\u304d\u76f4\u3059\uff09<\/p>\n<\/li>\n<li>\n<p><code>open .<\/code> \u3092\u5b9f\u884c\u3057\u3001\u73fe\u5728\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u30a8\u30af\u30b9\u30d7\u30ed\u30fc\u30e9\u30fc\u3067\u958b\u3051\u3070OK<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2024\/01\/2401-powershell_open_cmd.png\" alt=\"Windows PowerShell \u3067\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066\u3044\u308b\u753b\u9762\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\" width=\"862\" height=\"419\"  \/>\n<\/li>\n<\/ol>\n<h3>\u95a2\u9023\u30a8\u30f3\u30c8\u30ea\u30fc<\/h3>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u7f6e\u304d\u5834\u306b\u8a2d\u7f6e\u3057\u3066\u3044\u308b\u81ea\u4f5c\u30b3\u30de\u30f3\u30c9\u306f\u4ee5\u4e0b\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/hi3103.net\/notes\/windows\/1486\">Windows Powershell \u3067\u64ec\u4f3c\u7684\u306b open \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/a><\/li>\n<li><a href=\"https:\/\/hi3103.net\/notes\/windows\/1488\">PowerShell \u30671\u9031\u9593\u5206\u306e\u65e5\u5831\u3092\u307e\u3068\u3081\u308b\u305f\u3081\u306e Markdown \u5f62\u5f0f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u751f\u6210\u3059\u308b<\/a><\/li>\n<li><a href=\"https:\/\/hi3103.net\/notes\/windows\/1524\">masOS \u3067\u81ea\u52d5\u751f\u6210\u3055\u308c\u308b\u4e0d\u53ef\u8996\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u62ec\u524a\u9664\u3059\u308b PowerShell \u30b9\u30af\u30ea\u30d7\u30c8<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 Windows 11 \u4e0a\u3067\u3088\u304f\u884c\u3046\u64cd\u4f5c\u3092\u30b3\u30de\u30f3\u30c9\u3067\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u3001\u3061\u3087\u3044\u3061\u3087\u3044 PowerShell \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u308b\u3088\u3046\u306b\u306a\u3063\u305f \u30af\u30ea\u30fc\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3084\u8cb7\u3044\u66ff\u3048\u306a\u3069\u3067\u518d\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u969b\u3001\u7d20\u65e9\u304f\u5fa9\u65e7\u3067\u304d\u308b\u3088\u3046\u306b  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[101],"class_list":["post-1526","post","type-post","status-publish","format-standard","hentry","category-windows","tag-powershell"],"_links":{"self":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts\/1526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/comments?post=1526"}],"version-history":[{"count":0,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts\/1526\/revisions"}],"wp:attachment":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/media?parent=1526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/categories?post=1526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/tags?post=1526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}