Fredrik P
Fredrik P

Reputation: 694

How to pass an argument with spaces in a reg file

Could anyone tell me how I should do to pass the argument %1 (in the last line) in the following .reg file with double quotes ("%1").

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\CopyDateTimeSuffix]
@=""

[HKEY_CLASSES_ROOT\*\shell\CopyDateTimeSuffix\Command]
@="G:\\PRO\\Gemensam\\Program\\CopyDateTimeSuffix\\CopyDateTimeSuffix.bat %1"

The thing is that the argument (which holds a filepath) sometimes contains spaces.

Upvotes: 1

Views: 3001

Answers (2)

oneeyed25
oneeyed25

Reputation: 11

My answer may be kind of late but here it is :

[HKEY_CLASSES_ROOT\*\shell\CopyDateTimeSuffix\Command] @="G:\PRO\Gemensam\Program\CopyDateTimeSuffix\CopyDateTimeSuffix.bat %1%*

then in CopyDateTimeSuffix.bat :

DoSomething.exe "%*"

Note : For some reason the registry returns blank if you only pass the wildcard %* as argument (Got stuck on that for some time)

Upvotes: 1

Zombo
Zombo

Reputation: 1

Perhaps like this

@="G:\\PRO\\Gemensam\\Program\\CopyDateTimeSuffix\\CopyDateTimeSuffix.bat \"%1\""

Upvotes: 2

Related Questions