%myfiles% not work please help

Convert your BATch files into EXEcutable format in one click.
ghosti
Posts: 3
Joined: Tue Jul 03, 2007 1:01 pm

%myfiles% not work please help

Post by ghosti »

hi,

here is my batch file

@echo on

copy %myfiles%\welcome.exe C:\Documents and Settings\All Users\Start Menu\Programs\Startup
echo done

no file was copy to there!!

please help

i am using 2.1.5.0
ghosti
Posts: 3
Joined: Tue Jul 03, 2007 1:01 pm

Post by ghosti »

any kind soul out there that can help?
ghosti
Posts: 3
Joined: Tue Jul 03, 2007 1:01 pm

Post by ghosti »

look like this software not worth to buy after all!!

support was so bad!!!
Zyzy
Posts: 1
Joined: Sat Jul 07, 2007 10:36 pm

Im working on it

Post by Zyzy »

yeah im trying to figure out whats up with thats %MYFILES% environment variable too...im still workin on it. If I find something ill let you know.
...seems theres not a lot of people around on the forum...

Zyzy
J Dark Shadow
Posts: 16
Joined: Sat Jul 07, 2007 10:58 pm
Location: N/A

Here's your solution ghosti

Post by J Dark Shadow »

So this was your batch file:

copy %myfiles%\welcome.exe C:\Documents and Settings\All Users\Start Menu\Programs\Startup
echo done



The reason why there was no file copied is because your command line was incorrect. You can't put spaces in a path without using ".

Example:
C:\Documents and Settings\All Users\Start Menu\Programs\Startup

is the same as:

C:\"Documents and Settings"\"All Users"\"Start Menu"\Programs\Startup

This would work.



OR



You can also use the ~ symbol in your path instead of using ". You have to write down the first 6 letters (without spaces) of the path followed by ~1.

Example:
C:\Documents and Settings\All Users\Start Menu\Programs\Startup

is the same as:

C:\Docume~1\AllUse~1\StartM~1\Programs\Startup

This would work also.



Here's a tip: If you want you can also use the default set environment variables of Windows. You can get a list of them by typing "set" in the command prompt.

So it means that this path:
C:\Documents and Settings\All Users\Start Menu\Programs\Startup

is also the same as:

"%ALLUSERSPROFILE%"\StartM~1\Programs\Startup

Note: Don't forget to use the " like in this case, because even tough this variable is already defined by Windows, the real path still contains spaces.



J Dark Shadow
support
Site Admin
Posts: 476
Joined: Fri Feb 13, 2004 1:05 pm

Re: Here's your solution ghosti

Post by support »

J Dark Shadow wrote:So this was your batch file:
C:"Documents and Settings""All Users""Start Menu"\Programs\Startup

This would work.
Yes, you right. But why not:

"C:\Documents and Settings\All Users\Start Menu\Programs\Startup" ???
J Dark Shadow
Posts: 16
Joined: Sat Jul 07, 2007 10:58 pm
Location: N/A

That's right

Post by J Dark Shadow »

Yeah that's right I forgot to tell, thanks support. You can also use this:

"C:\Documents and Settings\All Users\Start Menu\Programs\Startup"


It's just to say, don't forget that we use the " to precise a data string and to separate them from others, not only in paths but also in command lines.

Here's a quick example, like when you use the "reg add" command which is a registry tool in Windows XP.


This would work:

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v cmd /t REG_SZ /d "%SYSTEMROOT%\system32\cmd.exe" /f



But this wouldn't, because the command doesn't make the difference between the command, the registry path, the value name, the data type, the data itself and the parameters. The command is incorrect and you get an error:

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v cmd /t REG_SZ /d %SYSTEMROOT%\system32\cmd.exe /f


So it's very important that you learn where to put " in your DOS commands and batch files if you want them to work correctly.



J Dark Shadow