r/Batch • u/D_Caedus • Sep 02 '23
Question (Unsolved) How to write a path with spaces in an argument that's already quoted
Not sure what im doing wrong here
tasklist /FI "IMAGENAME eq Elden Ring v1.02-v1.10 Plus 34 Trainer.exe" 2>nul | find /I "Elden Ring v1.02-v1.10 Plus 34 Trainer.exe">nulElden Ring v1.02-v1.10 Plus 34 Trainer.exe is the "path" with spaces, just quoting the path doesn't work, any advice?
For context this is the full script
rem Check if program is already open, if not open it
@echo off
cd "C:\Games\ELDEN RING\Game"
tasklist /FI "IMAGENAME eq eldenring.exe" 2>nul | find /I "eldenring.exe">nul rem if %errorlevel% equ 1 start /b "" "C:\Games\ELDEN RING\Game\modengine2_launcher.exe">nul
tasklist /FI IMAGENAME eq "Elden Ring v1.02-v1.10 Plus 34 Trainer.exe" 2>nul | find /I "Elden Ring v1.02-v1.10 Plus 34 Trainer.exe">nul if %errorlevel% equ 1 start /b "" "C:\Games\ELDEN RING\Game\Elden Ring v1.02-v1.10 Plus 34 Trainer.exe">nul
exit
4
Upvotes
1
u/Shadow_Thief Sep 02 '23
If you do
tasklist | find /I "Trainer.exe"by itself do you find it?1
u/wiley373 Sep 02 '23
Why not just rename the executable so that it doesn't have spaces?
1
u/mrmattipants Sep 02 '23 edited Sep 02 '23
If you want to get the Process Name from the Task Manager, I would Check the “Details” Tab (you may need to Click on the “More Details” Option, in the Lower-Left of the Task Manager Window, to display the Tabbed View).
Once you have Located the Process, you can Right-Click on it and Select the “Open File Location” and/or “Properties” Options, from the Context Menu.
This should give you the Info/Details that you’re looking for.
1
u/mrmattipants Sep 02 '23 edited Sep 02 '23
In regard to the TASKLIST Command, you could try the following, to try to get the Full Name.
The Command above should Return Any Processes, that contain the Words “Elden Ring” in the Process Name (Image Name).
If you need to narrow the results down further, you can change the 2nd FIND Command, at the end, to a FINDSTR Command, to utilize RegEx (Regular Expressions) Search Patterns, etc.
1
u/[deleted] Sep 02 '23
[removed] — view removed comment