我試圖從Windows運行批處理文件,下面的Perl代碼,但得到錯誤The file name, directory name, or volume label syntax is incorrect.
腳本運行在eclipse.My終極目標罰款定期運行該perl腳本使用Windows任務調度程序,因此從一個批處理文件運行它。
是否有與我們可以達到我在Windows上運行Perl腳本定期的目標的任何其他方式?
我想我的劇本是跨平臺的功能,怎麼我有計劃從Mac上運行它。Perl:爲什麼我會收到錯誤「文件名,目錄名稱或卷標語法不正確。」
use strict;
use warnings;
use Data::Dumper;
use File::Find::Rule;
my $basedir="G:\/My_Workspaces";
my @exclude_dirs= qw(.foo);
#Fetching all the workspaces under base dir excluding the ones in @exclude_dirs
my @subdirs =
File::Find::Rule
->mindepth(1)
->maxdepth(1)
->not_name(@exclude_dirs)
->directory
->in($basedir);
#Formating list of workspaces by removing the full path
s{^\Q$basedir\E/}{} for @subdirs;
除非有更多的在這個文件不是你已經證明,這是一個Perl的源文件,而不是Windows批處理文件。這正是你所擁有的嗎?另外請注意,僅支持Windows音量字母像'G:\ My_Workspaces' – Borodin
@Borodin:變量'$ basedir'的值將適用於Mac改變。這是我的perl代碼中使用目錄名稱的唯一部分。任何想法爲什麼我會得到錯誤?謝謝 ! – Jill448
不要逃避'/',這是一個正常的字符。 'X:/ foo/bar'應該可以在Windows上運行。 – Mat