how to stop a space from aborting a batch process

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Sebastian42
Posts: 15
Joined: 17 Feb 2017 02:28

how to stop a space from aborting a batch process

#1 Post by Sebastian42 » 20 Apr 2020 03:20

Start "" del /q c:\program files\glarysoft\malware hunter\mhtray.exe
does NOT delete that entry.
I suspect it is because of the space between 'program' and 'files'.
If that is true - what is the work around ?

miskox
Posts: 397
Joined: 28 Jun 2010 03:46

Re: how to stop a space from aborting a batch process

#2 Post by miskox » 20 Apr 2020 03:27

Use Quotes with filename/directory:

Code: Select all

Start "" del /q "c:\program files\glarysoft\malware hunter\mhtray.exe"
Saso

Sebastian42
Posts: 15
Joined: 17 Feb 2017 02:28

Re: how to stop a space from aborting a batch process

#3 Post by Sebastian42 » 20 Apr 2020 03:35

For reasons too embarrassing to admit, I can not test THAT line of code, but I do believe (I remember) that that is the solution.

Compo
Posts: 538
Joined: 21 Mar 2014 08:50

Re: how to stop a space from aborting a batch process

#4 Post by Compo » 20 Apr 2020 05:41

Based upon your provided example, I do not see any need for the start command in this case:

Code: Select all

Del /F /A "%ProgramFiles%\glarysoft\malware hunter\mhtray.exe"
The del command is internal, so effectively you're opening a new cmd.exe window with the /K option, which would then require closing afterwards, (see the command help, start /?, for more information).

It may also be worth mentioning that in order to delete something from that particular location, you'll probably need to run the command elevated, or as a user with the required privileges.

Sebastian42
Posts: 15
Joined: 17 Feb 2017 02:28

Re: how to stop a space from aborting a batch process

#5 Post by Sebastian42 » 20 Apr 2020 06:46

I realised that I only need to do that once - do not need to do it in a macro. The problem of the space was solved well by the double apostrophes. I withdraw the question.

Post Reply