首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Powershell启动-进程隐藏的带有空格的wmplayer文件

Powershell启动-进程隐藏的带有空格的wmplayer文件
EN

Stack Overflow用户
提问于 2022-08-30 06:40:20
回答 2查看 100关注 0票数 0

powershell Start-Process -WindowStyle Hidden 'C:\Program Files\Windows Media Player\wmplayer.exe' c:\windows\media\notify.wav运行正常。

powershell Start-Process -WindowStyle Hidden 'C:\Program Files\Windows Media Player\wmplayer.exe' c:\windows\media\windows background.wav跑得不好。

powershell Start-Process -WindowStyle Hidden 'C:\Program Files\Windows Media Player\wmplayer.exe' 'c:\windows\media\windows background.wav'跑得不好。

powershell Start-Process -WindowStyle Hidden 'C:\Program Files\Windows Media Player\wmplayer.exe' "c:\windows\media\windows background.wav"跑得不好。

powershell "& 'C:\Program Files\Windows Media Player\wmplayer.exe' 'c:\windows\media\windows background.wav'"运行正常,但没有隐藏。

请问如何修正论点中的空格?

EN

回答 2

Stack Overflow用户

发布于 2022-08-30 07:42:23

你需要用wmplayer.exe来做吗?应用程序将不可见,但它将作为要在任务管理器或Get-Process中找到的进程加载。powershell方法更符合:

代码语言:javascript
复制
powershell (New-Object System.Media.SoundPlayer('c:\windows\media\Windows Battery Critical.wav')).PlaySync()
票数 2
EN

Stack Overflow用户

发布于 2022-08-30 10:31:47

无可见播放器:

代码语言:javascript
复制
powershell (New-Object Media.SoundPlayer 'c:\windows\media\windows background.wav').PlaySync()

powershell $PLAYER = New-Object Media.SoundPlayer; $PLAYER.soundlocation='C:\windows\media\windows background.wav'; $PLAYER.PlaySync()

powershell Add-Type -AssemblyName presentationCore; $mediaPlayer = New-Object system.windows.media.mediaplayer; $mediaPlayer.open('c:\windows\media\windows background.wav'); $mediaPlayer.Play(); start-sleep 3

声音文件不支持空格:*

代码语言:javascript
复制
powershell Start-Process -WindowStyle Hidden 'C:\Program Files\Windows Media Player\wmplayer.exe' c:\windows\media\notify.wav & timeout 3 >nul & taskkill /f /im wmplayer.exe>nul

可见播放器:

代码语言:javascript
复制
"C:\Program Files\Windows Media Player\wmplayer.exe" "c:\windows\media\windows background.wav" & timeout 3 >nul & taskkill /f /im wmplayer.exe>nul

W10:

代码语言:javascript
复制
start "" "c:\windows\media\windows background.wav" & timeout 3 >nul & taskkill /f /im music.ui.exe>nul

start "explorer.exe shell:" "c:\windows\media\windows background.wav" & timeout 3 >nul & taskkill /f /im music.ui.exe>nul

W11:

代码语言:javascript
复制
start "" "c:\windows\media\windows background.wav" & timeout 3 >nul & taskkill /f /im microsoft.media.player.exe>nul

start "explorer.exe shell:" "c:\windows\media\windows background.wav" & timeout 3 >nul & taskkill /f /im microsoft.media.player.exe>nul
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73538152

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档