0

I am putting Kingsoft office on my flash drive, and I want to use a batch file to start the applications because the paths are not easily accessible, I cannon create a .lnk file because the path varies by computer because it may be plugged into a different port. Here is my batch file code, could somebody give some suggestions on how to make this work. Thanks in advance...

set "path=%~dp0"
start %path%office6\wpp.exe

The second line is the problem, the program won't start the program. Thanks!

Dmitry Pavliv
  • 35,333
  • 13
  • 79
  • 80
The Count
  • 43
  • 9
  • I think you're missing a backslash after `%path%` – lc. Sep 02 '13 at 05:00
  • don't use `path` as variable-name, because it's a systemvariable. Changing it, could lead to annoying results (well, not in your two-liner...) – Stephan Sep 02 '13 at 09:09
  • If you put echo %path% it displays C:\Users\Weston Miller\Desktop\Kingsoft Office\ and then I want to add office6\wpp.exe – The Count Sep 02 '13 at 14:48

2 Answers2

2
cd /d "%~dp0"
start "" /b wpp.exe
Endoro
  • 37,015
  • 8
  • 50
  • 63
0

I think some of the directory names in %path% contain spaces and since %path% is not enclosed within ""( double quotes), the script is unable to find the exe .

You may also want to include a log file so that it becomes easier to debug in case of any errors.

Try this:

set baseFolder=%~dp0
start "%baseFolder%office6\wpp.exe" > "%baseFolder%batchRunLog.log"
r3ap3r
  • 2,775
  • 2
  • 17
  • 16