08-27-2013
Quote:
Originally Posted by
LMHmedchem
I may be able to use "setlocal", but when the bat file finishes, it will close and I'm guessing that the temp assignment to the path will go with it. This means that I would need to have the bat file stay open until I close it intentionally when I am done.
As it is: no. Unix shells work like that, but DOS doesn't. In fact, when you set a variable in a DOS batch file its value stays until you start the
COMMAND.COM (or whatever replacement you use) anew. This is the reason why you can set the PATH variable in
AUTOEXEC.BAT and have that change be persistent.
I hope this helps.
bakunin
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I did a search and found lots of questions/comments about how a dos script could execute Unix but not the other way round. If it's possible, I'd like the link to a post/site that would show me the way.
Thanks. (4 Replies)
Discussion started by: BCarlson
4 Replies
2. Windows & DOS: Issues & Discussions
when i run in dos for example:
C: ls /temp
ls: cannot access /temp: No such file or directory
but when i run
C: ls \temp
windriver backup remotebackup
also when i run
C: ls temp
windriver backup remotebackup
The problems that i have all developpers scripts was written first like this... (0 Replies)
Discussion started by: mulder20
0 Replies
3. Linux
Hello ;
I have a problem running some script on dos .
when i run :
C: ls /temp
ls: cannot access /temp: No such file or directory
but when i run
C: ls \temp
windriver backup remotebackup
also when i run
C: ls temp
windriver backup remotebackup
The... (4 Replies)
Discussion started by: mulder20
4 Replies
4. Shell Programming and Scripting
Hi guys,
I need a *.bat to run a ksh file in the shell on Windows NT...nothing more :) How do I do it? I tried with the following but it failed:
set INFORMIXDIR=D:\user-applications\informix
set PATH=%INFORMIXDIR%;%PATH%
D:\user-applications\MKS\mksnt\sh.exe C:\hk_9.2\C3_weekly_auto.ksh... (4 Replies)
Discussion started by: Dird
4 Replies
5. Windows & DOS: Issues & Discussions
Hi,
(Apologies, I'm sure I'm not the first person to raise this question but so far in my searches haven't found a good answer).
I would like to output a listing per line of filename (including full path) and 'last updated' timestamp. e.g:
Z:\dir1\file1.txt 01/02/2010 10:43... (5 Replies)
Discussion started by: GM_AIX
5 Replies
6. Shell Programming and Scripting
1. What I am doing?
Building a DOS .bat file that will root my Droid 2 phone using adb commands in the .bat file. (Just for the fun of it and to help me learn "stuff".)
2. Problem:
Here are the problem steps to accomplish this task manually in an adb shell:
adb shell (Prompt is $)
cd... (2 Replies)
Discussion started by: chrstdvd
2 Replies
7. Solaris
hi All, here is the problem: I'm not able to specify a PATH inside the user crontab file (/var/spool/cron/crontabs). The only syntax it accepts is the usual "* * * * * file" I'm not able to add PATH, or HOME, or MAILTO, or anything else. when I try to save the crontab, I have the error: ... (1 Reply)
Discussion started by: joe_x
1 Replies
8. Shell Programming and Scripting
I need to put/get files from Windows machine to Unix machine and vice-versa.
I wrote a text file "ftp1.txt" as below.
naga
naga06
cd /root/Naga
prom off
get time.unl
bye
I wrote another bat file "ftp.bat" as below.
ftp -n -s:C:\Users\Naga\Desktop\ftp1.txt IP_ADDRESS
but... (2 Replies)
Discussion started by: Naga06
2 Replies
9. Windows & DOS: Issues & Discussions
Well I have a lot of scripts that require dragging and dropping files in order to define Source files etc.
However more often then not it is the case that the path to said file contains NUMEROUS spaces.
I know one way to evade this problem is to encase the path in Quotes like this:
... (7 Replies)
Discussion started by: pasc
7 Replies
10. UNIX for Beginners Questions & Answers
I'm curious to know how do I add an empty log file (test1.log) to an existing text file to monitor all the changes made to a.txt.
Is this expression
export PATH=$PATH:/home/test1.log
right to be added to the text file a.txt? (5 Replies)
Discussion started by: TestKing
5 Replies
LEARN ABOUT CENTOS
file::spec::win32
File::Spec::Win32(3) User Contributed Perl Documentation File::Spec::Win32(3)
NAME
File::Spec::Win32 - methods for Win32 file specs
SYNOPSIS
require File::Spec::Win32; # Done internally by File::Spec if needed
DESCRIPTION
See File::Spec::Unix for a documentation of the methods provided there. This package overrides the implementation of these methods, not the
semantics.
devnull
Returns a string representation of the null device.
tmpdir
Returns a string representation of the first existing directory from the following list:
$ENV{TMPDIR}
$ENV{TEMP}
$ENV{TMP}
SYS:/temp
C:system emp
C:/temp
/tmp
/
The SYS:/temp is preferred in Novell NetWare and the C:system emp for Symbian (the File::Spec::Win32 is used also for those
platforms).
Since Perl 5.8.0, if running under taint mode, and if the environment variables are tainted, they are not used.
case_tolerant
MSWin32 case-tolerance depends on GetVolumeInformation() $ouFsFlags == FS_CASE_SENSITIVE, indicating the case significance when
comparing file specifications. Since XP FS_CASE_SENSITIVE is effectively disabled for the NT subsubsystem. See
http://cygwin.com/ml/cygwin/2007-07/msg00891.html Default: 1
file_name_is_absolute
As of right now, this returns 2 if the path is absolute with a volume, 1 if it's absolute with no volume, 0 otherwise.
catfile
Concatenate one or more directory names and a filename to form a complete path ending with a filename
canonpath
No physical check on the filesystem, but a logical cleanup of a path. On UNIX eliminated successive slashes and successive "/.". On
Win32 makes
dir1dir2dir3....dir4 -> dirdir4 and even
dir1dir2dir3...dir4 -> dirdir4
splitpath
($volume,$directories,$file) = File::Spec->splitpath( $path );
($volume,$directories,$file) = File::Spec->splitpath( $path,
$no_file );
Splits a path into volume, directory, and filename portions. Assumes that the last file is a path unless the path ends in '\', '\.',
'\..' or $no_file is true. On Win32 this means that $no_file true makes this return ( $volume, $path, '' ).
Separators accepted are and /.
Volumes can be drive letters or UNC sharenames (\servershare).
The results can be passed to "catpath" to get back a path equivalent to (usually identical to) the original path.
splitdir
The opposite of catdir().
@dirs = File::Spec->splitdir( $directories );
$directories must be only the directory portion of the path on systems that have the concept of a volume or that have path syntax that
differentiates files from directories.
Unlike just splitting the directories on the separator, leading empty and trailing directory entries can be returned, because these are
significant on some OSs. So,
File::Spec->splitdir( "/a/b/c" );
Yields:
( '', 'a', 'b', '', 'c', '' )
catpath
Takes volume, directory and file portions and returns an entire path. Under Unix, $volume is ignored, and this is just like catfile().
On other OSs, the $volume become significant.
Note For File::Spec::Win32 Maintainers
Novell NetWare inherits its File::Spec behaviour from File::Spec::Win32.
COPYRIGHT
Copyright (c) 2004,2007 by the Perl 5 Porters. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
See File::Spec and File::Spec::Unix. This package overrides the implementation of these methods, not the semantics.
perl v5.16.3 2013-01-16 File::Spec::Win32(3)