VOGONS

Common searches


First post, by nvm

User metadata
Rank Newbie
Rank
Newbie

I'm trying to write some dos batch script for manipulating some paths. I haven't done this in years so I might be rusty.

The path is relative and given from the command line as argument

@echo off
set wpath=%1
@echo.%wpath%
set newpath=%wpath:~0,-4%
@echo.%newpath%

The thing I'm trying to accomplish is to get rid of the extension

script.bat whatever/test.txt
whatever/test.txt
whatever/test

But I'm getting

script.bat whatever/test.txt
whatever/test.txt
<emptyline>

I'm using DOSBox version 0.74 and this as a reference

Reply 3 of 5, by VileR

User metadata
Rank Oldbie
Rank
Oldbie

well, that reference site calls itself DOS Tips yet says it's "for Windows7, VISTA ,XP, NT, Server 2000, Server 2003, Server 2008".

[cue Family Guy style showtune parody - "the Windows command prompt isn't DOS, isn't DOS, isn't DOS"]

Do you need the extension-less pathname as a variable? or just want to echo it out?

[ WEB ] - [ BLOG ] - [ TUBE ] - [ CODE ]