小弟不才,
以下是我想要製做的CMD 功能,
CCLS
@ECHO ON
for %%i in (e f g h i j k l m n o p q r s t u v w x y z) do if exist %%i:\TEST set USB=%%i
start /wait %USB%:\TEST\Test.txt
如何用Poweshell 指令來做一樣的事?
麻煩指教了,
謝謝!!
$drives = Get-PSDrive | ? {$_.Provider.Name -eq "FileSystem" }
foreach ($drive in $drives) {
if (Test-Path ($drive.Name + ":\TEST")) {
Invoke-Item ($drive.Name + ":\TEST\Test.txt")
}
}