5

I am using IEcapt.exe to capture website snapshot. The problem is, it cannot handle path directory that have space. Like this:

c:\program files\

Is there any way how I can pass directory like this to make it work?

4 Answers 4

12

Usually just double-quoting windows paths will work:

IEcapt.exe "C:\Program Files\some path"

If that really doesn't work, you might be able to get away with using the 8.3 filename or, in the case of program files, the %programfiles% variable.

1
  • 1
    Updated with a link from the Wayback Machine.
    – kojiro
    Feb 18, 2019 at 14:23
2

See the reply from kojiro. However, here is a trick if you really aren't able to use blank spaces or long file names, because the tools you call do not support that. I've had this case with some build tools from MS.

Since short filenames are not allowed to contain blank spaces, we can use:

%~sI

... where I is the number of the parameter to the current sub (or the script). Since this is a feature that only works on numbered parameters, you may have to use an indirection, such as:

call :mysub "%ProgramFiles%"

:mysub
set VARIABLE=%~s0
goto :eof
0

kojiro's answer works. But in my case I needed to

IEcapt.exe "%programfiles%\some path"

instead of

IEcapt.exe %programfiles%\some path

The second example works with echo command to print the entire path on screen for example, but I needed the first example to pass it correctly to my script.

0

I wish that I could have used one of the methods above. However, I could only use the old DOS short names.

DOS file names longer than 8 characters were truncated with ~number for files. For example, C:\Program Files would be c:\progra~1, and C:\Program Files (x86) would be c:\progra~2.

You can find the short names for files using DIR /X command.

I needed this specifically to launch ConEmu from within Atom text editor.

I derived this approach from Sachleen's Answer HERE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.