windows can't find .exe when i make a batch file
so I need to create a batch file so I can run a program at startup. I looked online and found a very simple instruction to make a batch file. I opened notepad and put
start "c:\windows\windows32\" notepad.exe
saved it and it works fine so set about making mine.
again in notepad.
start "c:\server\" fcserver.exe
get the error message that windows can't find the file, but it is definitely there. just to make sure the path was right I copied notepad.exe into the server folder which works.
start "c:\server\" notepad.exe
it just doesn't seem to see the fcserver.exe although I can see it and I can run it from CMD using the same path.
"c:\server\"
doesn't specify the path as you may think. From this answer to the question Using the “start” command with parameters passed to the started program
START has a peculiarity involving double quotes around the first parameter. If the first parameter has double quotes it uses that as the optional TITLE for the new window.
The example with notepad.exe
works because c:\windows\windows32\
is in your %PATH%
.
You should instead be using
start c:\server\fcserver.exe
or if you need to quote the path
start "" "c:\server\fcserver.exe"
The START parameter syntax is the following.
start ["<Title>"] [/d <Path>] [/i] [{/min | /max}] [{/separate | /shared}] [{/low | /normal | /high | /realtime | /abovenormal | belownormal}] [/affinity <HexAffinity>] [/wait] [/b {<Command> | <Program>} [<Parameters>]]
Start - Documentation