Page 1 of 1 1
Topic Options
#95464 - 2002-11-15 07:55 PM Way Off Topic - DOS batch cmd "~1" problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
This is way off-topic...
KiXtart scripting is *not* an option (don't ask)...
DOS batch scripting is the *only* option (don't ask)...
Have trawled just about everywhere without success...

The following DOS batch line returns the expected error "invalid number of parameters" owing to spaces in the destination.
code:
ECHO F|XCOPY .\shortc~1.lnk c:\docume~1\all users\start menu\programs\startup /N /V /Y

The puzzle is how to "~1" the folder names all users and start menu.
Given that there are spaces before char position 7, the constructs all~1 and start~1, or variations thereof that I've tried, puke by creating folders with those names...

Any inspiration is welcome...
Thanks...
_________________________
We all live in a Yellow Subroutine...

Top
#95465 - 2002-11-15 07:58 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Without actually testing, why could you not just wrap the parms in quotes? You could also use the enviro vars.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#95466 - 2002-11-15 08:07 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Les...
The quote thingy doesn't cut it...
Will try the envar thingy...
Film at Eleven...
Thanx...
_________________________
We all live in a Yellow Subroutine...

Top
#95467 - 2002-11-15 08:19 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
No go...
Without the quote wrappers no change...
With the quote wrappers it creates a gigo file... [Frown]
code:
SET FOLDER1=all users
SET FOLDER2="start menu"
ECHO F|XCOPY .\shortc~1.lnk c:\docume~1\%FOLDER1%\%FOLDER2%\startup /N /V /Y
SET FOLDER1=
SET FOLDER2=



[ 15. November 2002, 20:23: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#95468 - 2002-11-15 08:19 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
It works for me... well sorta.

ECHO F|XCOPY "C:\test.cmd.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs\Startup" /N /V /Y

Only prob is XCOPY does not preserve the long name so the CS ends up as TESTCM~1.LNK
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#95469 - 2002-11-15 08:26 PM Re: Way Off Topic - DOS batch cmd "~1" problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11629
Loc: CA
Waltz,

Go here and get PATH COPY then install and after install right click and do setup and you will have options to get the path you want I think.

Path Copy

Also, as Les says... XCOPY does not support long file names. What is wrong with just COPY?

Also command line WinZip and then zip and unzip to where you want also works.

Top
#95470 - 2002-11-15 09:06 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Bingo...
It helps if you're @#~ keyboard isn't broken... [Embarrassed]
My target path was missing "\Programs\" in my original test...
This works just fine...
code:
ECHO F|XCOPY ".\shortc~1.lnk" "C:\Docume~1\All Users\Start Menu\Programs\Startup" /N /V /Y 

The long name thingy is a non-issue this time around...
The path copy thingy is good idea, but for the unique requirement that I have (don't ask)... is not a viable option; will store it for future reference, though...
FWIW, I've used XCOPY instead of COPY since the days when I had to carve my transistors out of wood...
Thanks a bunch for your help...
_________________________
We all live in a Yellow Subroutine...

Top
#95471 - 2002-11-15 09:14 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hehee...
you heard about the env vars? [Wink]

this:
C:\Docume~1\

in your case might be good but it can also be:
G:\Docume~2\

if you want to get it right, try with:
%userprofile%
_________________________
!

download KiXnet

Top
#95472 - 2002-11-15 09:21 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Nada...
I'm thinking %userprofile% in Canada reflects 'currentuser' and not 'all users'
Is it different in Finland? [Razz]
_________________________
We all live in a Yellow Subroutine...

Top
#95473 - 2002-11-15 09:31 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Spark up a DOS box ant type set. Look, way up, and I'll call Rusty... [Big Grin]
quote:
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#95474 - 2002-11-15 09:33 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
was just writing reply but then somehow [Roll Eyes] noticed that les replied for me, thanks
_________________________
!

download KiXnet

Top
#95475 - 2002-11-15 09:36 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
No more being redundant, thanks to budda bing. [Big Grin]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#95476 - 2002-11-15 10:09 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
You seem to have resolved everything but why not use Robocopy or xxcopy. Both have better parameters for batch jobs. Robocopy copy from the NT3.51 Resource kit will work even with Win9x clients.
_________________________
Jack

Top
#95477 - 2002-11-15 10:25 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
...and a hehee, right back at ya...
I'm guessing that my keyboard isn't the only one that's broken [Big Grin]
quote:
if you want to get it right, try with:
%userprofile%

...bottom line...it worked and my client is happier than a 3 legged man in an arse kicking contest...
...regarding repetitive redundancies...
quote:
(don't ask)...
Have a good weekend, guys... [Smile]
_________________________
We all live in a Yellow Subroutine...

Top
#95478 - 2002-11-15 10:30 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
waltz, are you leaving us?
the weekend is the best time to code when there is no stupid work to interrupt you! [Big Grin]

{edit}
someone had changed the "code" with "go"
fixed.

[ 15. November 2002, 22:36: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#95479 - 2002-11-15 10:33 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
...have to go to my other job... [Mad]
...beer isn't just for breakfasts, anymore...
_________________________
We all live in a Yellow Subroutine...

Top
#95480 - 2002-11-15 10:37 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
waltz, tell me where I can get weeken job also?
your assistant?

my boss said just:
"if you don't get it done, ok.
if you work overtime, screw you!"
_________________________
!

download KiXnet

Top
#95481 - 2002-11-15 10:59 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
...my boss just said...
'If they wanted it yesterday they should have asked for it tommorrow. If you don't get it done, nobody cares. If you work over time, we'll give you triple time and pay for all the beer, burgers, and butts, no questions asked, no receipts required, and you don't have to come back 'til Tuesday.'
...she also asked me to explain this...
quote:
Microsoft Windows XA [Amateur Version 6.2.1.5000]
Z:> Set
ALLUSERPROFILE<>USERPROFILE

[Roll Eyes]
_________________________
We all live in a Yellow Subroutine...

Top
#95482 - 2002-11-15 11:10 PM Re: Way Off Topic - DOS batch cmd "~1" problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
can I get a job there, can I?

I can do your job but you can take all the credit! plz!!!
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1179 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.141 seconds in which 0.11 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org