If Exist in Windows 7
Moderator: DosItHelp
-
- Posts: 2
- Joined: 08 Jun 2011 09:26
If Exist in Windows 7
I have a one line command that has worked for years. I have now upgraded to Windows 7 and the command no longer works. The code follows.
IF EXIST c:\nightact\archive\%1.zip del c:\daily\prt*.*
It's very simple but the code does not work in Windows 7. I can still run the exact same code on an XP box.
Any help would be appreciated.
Beth
IF EXIST c:\nightact\archive\%1.zip del c:\daily\prt*.*
It's very simple but the code does not work in Windows 7. I can still run the exact same code on an XP box.
Any help would be appreciated.
Beth
Re: If Exist in Windows 7
beth.harless wrote:I have a one line command that has worked for years. I have now upgraded to Windows 7 and the command no longer works. The code follows.
IF EXIST c:\nightact\archive\%1.zip del c:\daily\prt*.*
It's very simple but the code does not work in Windows 7. I can still run the exact same code on an XP box.
Any help would be appreciated.
Beth
Code: Select all
@echo off
if exist loader.bat (
echo Yes
) else (
echo No
)
pause
I don't get it it works just fine...
-
- Posts: 2
- Joined: 08 Jun 2011 09:26
Re: If Exist in Windows 7
When I run this code set up as a batch program, it's supposed to delete all the files of type prt*.* in the subfolder. The files do not get deleted.
Re: If Exist in Windows 7
i think microsoft have Intentionally made cmd less reliable for powershell to dominate
and to expose its new object based scripting approach
powershell 2.0 comes with windows 7 so now you'd better use powershell or convert your cmd batch scripts to powershell
cmd is no longer powerful in windows 7 and it will not be in the next windows to come
better be
and to expose its new object based scripting approach
powershell 2.0 comes with windows 7 so now you'd better use powershell or convert your cmd batch scripts to powershell
cmd is no longer powerful in windows 7 and it will not be in the next windows to come
Code: Select all
IF EXIST c:\nightact\archive\%1.zip del c:\daily\*.prt
better be
Code: Select all
if (test-path c:\nightact\archive\args[0].zip) {remove-item c:\daily\prt*.* -recurse -force}
Re: If Exist in Windows 7
allal wrote:powershell 2.0 comes with windows 7 so now you'd better use powershell or convert your cmd batch scripts to powershell
cmd is no longer powerful in windows 7 and it will not be in the next windows to come
What the hell is powershell
I didn't need to remember that name, as in some years microsoft say "Wow: Now our new script language for ever..."
If you really need to use a script language take python, perl, ruby, php or something else, they will exist, suppoerted and run also in twenty years, but not powershell, nor jscript nor cscript.
Even batch will life longer.
jeb
Re: If Exist in Windows 7
jeb wrote:allal wrote:powershell 2.0 comes with windows 7 so now you'd better use powershell or convert your cmd batch scripts to powershell
cmd is no longer powerful in windows 7 and it will not be in the next windows to come
What the hell is powershell
I didn't need to remember that name, as in some years microsoft say "Wow: Now our new script language for ever..."
If you really need to use a script language take python, perl, ruby, php or something else, they will exist, suppoerted and run also in twenty years, but not powershell, nor jscript nor cscript.
Even batch will life longer.
jeb
don't you remember the limitation which was cast on google on windows 7 by microsoft the first time win 7 was launched
microsoft is good at doing things like that even if cmd is great for scripting and google is great for searching microsoft creates obstacle like to make the bing searcher engine ideal for win7 users and the same thing for cmd
-
- Posts: 287
- Joined: 16 Mar 2011 19:17
- Location: scriptingpros.com
- Contact:
Re: If Exist in Windows 7
jeb wrote:allal wrote:powershell 2.0 comes with windows 7 so now you'd better use powershell or convert your cmd batch scripts to powershell
cmd is no longer powerful in windows 7 and it will not be in the next windows to come
What the hell is powershell
I didn't need to remember that name, as in some years microsoft say "Wow: Now our new script language for ever..."
If you really need to use a script language take python, perl, ruby, php or something else, they will exist, suppoerted and run also in twenty years, but not powershell, nor jscript nor cscript.
Even batch will life longer.
jeb
@jeb
Well this is one of the first times I think you have stated something on a personal level, at least that I have read that is just, blind.
Yes python, perl, ruby, and php are going nowhere, some of these first off are designed for server side scripting in web development application, and second do not come native on windows. So, when windows 9,999 comes out, I'm sorry to say but powershell will be there and yes it will inevitably take over bacth that is just a fact, that is how Microsoft has been doing business forever, you know that. Microsoft is not known for great products, they are a sales company, and if they were not good at brainwashing the corporations, every fortune 5 company would be running unix based OS's. Jeb I think showing no emotion and speaking in zeros and ones works best for you. j/k
Your insight is always appreciated.