「Windowsでエクスプローラーからフォルダを各種ターミナルで開く」の版間の差分

Notion-MW
Notion-MW
302行目: 302行目:
たとえば以下のようなvbsを用意する。
たとえば以下のようなvbsを用意する。


m_with_cap_m
<syntaxhighlight style="margin-bottom:0.2em;" lang="python">vb.net
 
Dim objShell
<pre class="visual">Dim objShell
Set objShell = CreateObject("WScript.Shell")
Set objShell = CreateObject(&quot;WScript.Shell&quot;)
objShell.CurrentDirectory = WScript.Arguments(1)
objShell.CurrentDirectory = WScript.Arguments(1)
objShell.Run(WScript.Arguments(0)),,False</pre>
objShell.Run(WScript.Arguments(0)),,False</syntaxhighlight>
<div style='text-align: center;'>startatdir.vbs</div>
<div style='text-align: center;'>startatdir.vbs</div>


490行目: 489行目:
<li><p>vbsの例</p>
<li><p>vbsの例</p>
<p>次の節で解説する「(自分が起動された)カレントディレクトリでの起動」にも対応している(引数がない場合)。</p>
<p>次の節で解説する「(自分が起動された)カレントディレクトリでの起動」にも対応している(引数がない場合)。</p>
<pre class="visual">Dim objShell
<syntaxhighlight lang="python">
 
vb.net
Dim objShell
Dim curDir
Dim curDir


Set ws = CreateObject(&quot;Wscript.Shell&quot;)
Set ws = CreateObject("Wscript.Shell")
Dim dir
Dim dir
If WScript.Arguments.Count = 0 Then
If WScript.Arguments.Count = 0 Then
500行目: 502行目:
   dir = Wscript.Arguments(0)
   dir = Wscript.Arguments(0)
End If
End If
dir = Replace(dir,&quot;%&quot;,&quot;==%&quot;)
dir = Replace(dir,"%","==%")
ws.run &quot;powershell -Command &quot;&quot;&amp; {Start-Process -Verb Runas -Filepath wt -Argumentlist powershell, -noexit, -command, Set-Location, -LiteralPath, ('\&quot;&quot;'''+($args[1].Trim('\&quot;&quot;') -replace '''', '''''' -replace ';', '\;' )+'''.Replace(''==%'',''%'')\&quot;&quot;')}&quot;&quot; --% &quot;&quot;\&quot;&quot;&quot;&amp;dir&amp;&quot;\&quot;&quot;&quot;&quot;&quot;, vbHide
ws.run "powershell -Command ""& {Start-Process -Verb Runas -Filepath wt -Argumentlist powershell, -noexit, -command, Set-Location, -LiteralPath, ('\""'''+($args[1].Trim('\""') -replace '''', '''''' -replace ';', '\;' )+'''.Replace(''==%'',''%'')\""')}"" --% ""\"""&dir&"\""""", vbHide


Set objShell = Nothing</pre></li></ul>
Set objShell = Nothing</syntaxhighlight></li></ul>
</li>
</li>
<li><p>cmd</p>
<li><p>cmd</p>
513行目: 515行目:
<p><code>&quot;C&#58;\Program Files\Git\usr\bin\sh.exe&quot; &quot;C&#58;\path\to\gb&#45;wt&#45;admin.sh&quot; &quot;%V&quot;</code></p>
<p><code>&quot;C&#58;\Program Files\Git\usr\bin\sh.exe&quot; &quot;C&#58;\path\to\gb&#45;wt&#45;admin.sh&quot; &quot;%V&quot;</code></p>
<p>で、<code>gb&#45;wt&#45;admin.sh</code>の中身は以下。</p>
<p>で、<code>gb&#45;wt&#45;admin.sh</code>の中身は以下。</p>
<syntaxhighlight lang="c#">#!/bin/sh
<syntaxhighlight lang="python">
 
c#
#!/bin/sh
IFS=
IFS=
LANG=en_US.UTF-8
LANG=en_US.UTF-8